Re: Why no compositional positioning?

On 16 Mar 2009, at 14:57, Tab Atkins Jr. wrote:

> On Mon, Mar 16, 2009 at 8:47 AM, Thomas Davie <tom.davie@gmail.com>  
> wrote:
>> Hi,
>>  I have wondered for a long time, but never previously asked, why  
>> does css
>> not support a compositional positioning mode which positions elements
>> relative to the top left of the parent div?  This layout mode would  
>> make
>> several layouts significantly easier, and allow for easier  
>> transplantation
>> of elements from page to page, as layouts would continue to work  
>> everywhere.
>>
>> Is there an obvious reason for the omission that I'm missing, or  
>> has it
>> simply not been thought of?
>
> Can you be more specific about exactly what you're wanting?  It seems
> like this can be accomplished solely by making the parent a
> positioning ancestor (by making it position:relative, frex) and then
> using absolute positioning on the child.

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.

I hope that clarifies what I'm asking.

Thanks

Bob

Received on Monday, 16 March 2009 14:11:46 UTC