- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 16 Mar 2009 09:15:48 -0500
- To: Thomas Davie <tom.davie@gmail.com>
- Cc: www-style@w3.org
On Mon, Mar 16, 2009 at 9:08 AM, Thomas Davie <tom.davie@gmail.com> 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.
~TJ
Received on Monday, 16 March 2009 14:16:23 UTC