Because position: absolute
resets the relative position for children just as position: relative
does.
There is no way around this – if you want the third div
to be absolutely positioned relatively to the first one, you will have to make it a child of the first one.
More Related Contents:
- How to center a “position: absolute” element
- ‘transform3d’ not working with position: fixed children
- Why aren’t my absolutely/fixed-positioned elements located where I expect?
- How does the “position: sticky;” property work?
- Why does position:relative; appear to change the z-index?
- Why do absolute elements stack up on each other instead of stacking one after the other?
- Absolute position is not working
- Position: sticky buttons not working in IE 11
- ‘position: sticky’ not working when ‘height’ is defined
- Center aligning a fixed position div
- Position absolute and overflow hidden
- How to make div’s percentage width relative to parent div and not viewport
- Why is an element with position: fixed moving with a non-positioned sibling?
- Why isn’t my margin working with position: fixed?
- Why doesn’t width/height work with non positioned pseudo elements?
- Position fixed doesn’t work when using -webkit-transform
- body { overflow-x: hidden; } breaks position: sticky
- Why using absolute position causes the div to be on top?
- sticky position on css grid items
- How can I make the contents of a fixed element scrollable only when it exceeds the height of the viewport?
- How to work with ellipsis in bootstrap responsive table
- Styling text input caret
- Can specific text character change the line height?
- Make Iframe to fit 100% of container’s remaining height
- CSS media queries for screen sizes
- Width 100% with white borders around it. WHy?
- Why would the height increase with a smaller font size?
- How can you hide the arrow that is displayed by default on the HTML5 element in Chrome?
- How to change a span to look like a pre with CSS?
- Can you style ordered list numbers?