HTML & CSS
/Advanced
Absolute
Definition
Removes an element completely from the normal document flow. It is positioned relative to its closest positioned ancestor (not necessarily the viewport).
Explain Like I'm New
The element is ripped out of the HTML document entirely, like picking up a sticker. The elements below it instantly slide up to fill the empty space. You can then stick that element anywhere on the screen using coordinates.
Real World Example
A red notification badge (like '3 new messages') sitting in the top-right corner of a profile picture.
Common Use Cases
- •Tooltips
- •Dropdown menus
- •Notification badges
- •Overlay modals
Interactive Example
Interview Questions
basic
- If an element is `position: absolute`, what happens to the elements below it?
intermediate
- How does an absolute element decide where `top: 0` is?