<div class=”parent”> <div class=”box” id=”one”>One</div> <div class=”box” id=”two”>Two</div> <div class=”box” id=”three”>Three</div> <div class=”box” id=”four”>Four</div> </div>
.parent { border: 2px black dotted; display: inline-block; } .box { display: inline-block; background: red; width: 100px; height: 100px; } #two { background: green; }
#two { top: 20px; bottom: 20px; background: green; position: relative; }
NOTE: Relative Position places an element relative to its current position.
#two { top: 20px; bottom: 20px; background: green; position: absolute; }
NOTE: Absolute Position has the offset relative to the parent.