Just a note:
position:relative and position:absolute refer to 0;0 closest parent that has position:relative or position:absolute . If none of your div has one, then it refers to 0;0 (top left) of the document ( body ).
position:relative - the upper and left parts mean the difference between the natural value of the element flow - i.e. if the "image" has a natural flux of x 1500 and y 1200, top: 150px; left: -50px; top: 150px; left: -50px; move it to x: 1450; y: 1350; x: 1450; y: 1350;
position:absolute - the top and left are aligned with respect to 0;0 nearest p:r or p:a parent element, regardless of the natural flow - ex. (in pseudo html / css):
<div style="relative/absolute"> <img absolute="top:-20px; left: 150px;"> </div>
The image will be 20px above and 150 pixels to the right of the upper left corner of the parent div.
However, you want your container to be both relative and absolute, and both your stacked images should be position:relative with top: 0; left: 0; top: 0; left: 0; . Remember to set z-index if you want better control over layering.
-A
source share