I’m trying to make two squares overlap eachother in a parent div. The squares are using position:inherit. Please note that the number of squares will be dynamic. Also note that the parent div is using margin-left: 30%. Is this possible?
<div style="border: 1px solid Black; width: 300px; height:300px; margin-left:30%;">
<div style="height:40px; width:40px; border: 1px solid Black; position:inherit; left:0px; top: 0px;"></div>
<div style="height:40px; width:40px; border: 1px solid Black; position:inherit; left:0px; top: 0px;"></div>
</div>
Get rid of the
position: inherit;and useposition: relative;.Using the
top,right,bottomandleftproperties you can move an element and making it overlap.CSS
HTML