Re: Why no compositional positioning?

On Mon, Mar 16, 2009 at 9:08 AM, Thomas Davie <> wrote:
> Maybe I am indeed missing something that is in css.  I'll give a simple
> example:
> <div id="a">
>  <div id="b">
>    <p>This is in div b</p>
>  </div>
> </div>
> #a
> {
>  position: absolute;
>  left: 100px;
> }
> #b
> {
>  position: parentRelative;
>  left: 10px;
> }
> In this example I would expect b to act as if it were absolutely positioned,
> but with the bounding box of a acting as the bounding box of the page.  i.e.
> the text "this is in div b" should appear 110px from the left of the page.

Change the #b rule to position:absolute, and it does exactly what you want.

Absolute positioning uses as its reference point the nearest ancestor
that isn't position:static.  You can use position:absolute, as in your
example, or position:relative if you don't want to remove the parent
from the flow.


Received on Monday, 16 March 2009 14:16:23 UTC