Reputation: 1459
It doesn't make sense to me.
If I want a div to be left:20px;top:20px from the container edge, I should be able to do something like position:absolute-within-parent;. Defining the positioning of a child should not require modification of the parent.
At least it seems more modular and decoupling that way. And as a programmer I've been taught to obsess with that.
Upvotes: 8
Views: 2639
Reputation:
Absolute positioning is relative to something called the containing block. The containing block is the closest parent which has relative or absolute positioning (which may be the body
element if nothing else could be found). This allows you to position an element relative to any one of its parents. absolute-within-parent
would restrict you to only being able to absolutely position an element relative to its immediate parent, which isn't always what you need.
Upvotes: 9