Complete Independence

position: absolute completely removes an element from flow. Browser draws it on a separate layer, while other elements behave as if this block never existed.

" Base " Search Algorithm:

An absolute element searches for the nearest ancestor whose position is NOT static.

  1. If it finds a parent with relative, absolute, or fixed — it sticks to their boundaries.
  2. If it reaches the very top (HTML) and finds no one — it positions relative to viewport (browser window).
.parent { position: relative; padding: 20px; }
.child {
  position: absolute;
  top: 0; left: 0; /* Will stand exactly in parent's top-left corner */
}
Caution

The width: 100% property on an absolute element makes it stretch to the full width of its positioned parent, not the nearest div.