Reputation: 55729
Relative
positioning is the same as the default static
positioning, except you can use offset values (top, left, etc.).
Relative
seems objectively more powerful that static
positioning.
Is there any disadvantage to resetting in CSS all elements to be relative
(and overriding for absolute
as required)?
Upvotes: 0
Views: 115
Reputation: 19022
Absolute positioned elements are relative to the closest relative container. If you set everything to relative then it will be a PITA to use absolute positioning in cases where you want your absolute element to be positioned relative to an ancestor further up the tree, because the parent of the absolute element will always be relative.
Upvotes: 1
Reputation: 943510
Relative positioning establishes a new context for absolutely positioned descendants (which are positioned with the respect to the edges of their closest ancestor that is not statically positioned).
Upvotes: 3