4 ms·
> In absolute positioning, we define exact pixel for html element where it will appear. This starts from the top left of the parent element. This is quite wron
by gildas 14y ago
> In absolute positioning, we define exact pixel for html element where it will appear. This starts from the top left of the parent element.
This is quite wrong. Here is what the W3C specs say:
> In the absolute positioning model, a box is explicitly offset with respect to its containing block [1]
> The containing block for a positioned box is established by the nearest positioned ancestor [2]
> An element is said to be positioned if its 'position' property has a value other than 'static' [3]
[1] http://www.w3.org/TR/CSS2/visuren.html#absolute-positioning http://www.w3.org/TR/CSS2/visuren.html#absolute-positioning
[2] http://www.w3.org/TR/CSS2/visuren.html#comp-abspos http://www.w3.org/TR/CSS2/visuren.html#comp-abspos
[3] http://www.w3.org/TR/CSS2/visuren.html#position-props http://www.w3.org/TR/CSS2/visuren.html#position-props