Blog Post

Relatively Positioning Absolute Elements

You can localize where an absolutely positioned element is placed by setting a position: relative on the parent element. Instead of letting a zombie wander all over, you lock him in a cell so he can only shuffle around within a defined area.

<div id=“zombie-dad”>
   <div id=“undead-daughter”></div>
</div>
<div class=“zombie-dad”>
   <div id=“undead-son”></div>
</div>
#undead-son { position: absolute;}
#undead-daughter { position: absolute;}
#zombie-dad { position: relative;}"