1 min readNov 9, 2016
Agree, with one caveat on absolute positioning. It’s not positioned relative to the document, it’s positioned relative to the first parent element with a position other than static. It’s only positioned relative to the document if every parent is statically positioned. If a parent element has a position value of relative, fixed, or absolute, a child element of that with a position of absolute will be positioned relative to that element.
.box {
position: relative;
}
.inner-box {
position: absolute;
top: 50px;
}
if .inner-box
is nested inside of .box
, then .inner-box
will be 50px down from the top edge of .box