Re: an alternative to the 'position' property allowing more precise control

Daniel Glazman wrote:
> 
> The document [1] outlines a very simple solution to do box positioning 
> in a more precise way than what allows CSS2 for the time being. It's not 
> just a conceptual approach. This model _is_ implemented, although not 
> with the corresponding CSS bla-bla, in the descendants of the Grif 
> editor, including W3C's Amaya.

I like this proposal a lot but it does seem that there's one aspect of 
current behavior that it doesn't capture. The current definition of 
position: absolute is that its 'frame of reference' (for want of a 
better term) is not the element's immediate parent, but rather the 
closest containing parent that has position: relative.

This means that given:

<div id="div1"><div id="div2"><div id="div3">Content</div></div></div>

It's possible to position div3 with respect to div1, rather than div2:

#div1 {position: relative}
#div3 {position: absolute; ...}

It seems to me that the ability to define which elements cause a new 
containing block (by use of position: relative) is an extremely powerful 
feature that shouldn't be discarded in a new scheme (even though I 
understand you don't plan to deprecate 'position', I'd like to see the 
new scheme be strictly more powerful than the old...)

I suggest that as well as window, root, enclosing, previous and self, 
you add another value which I'll call containing-block[1]. This value 
would mean "relative to the closest containing element that provides a 
containing block".

Then we define a new CSS property called provides-containing-block[1] 
with three values: auto, true and false (initial value is 'auto' and it 
doesn't inherit). auto means "true for the root element and elements 
with position: relative, false otherwise" - this provides consistency 
with the existing spec which says that position: relative causes a 
containing block while all other position:s don't.

This proposal allows the new and old schemes to work together seamlessly 
(old style position: absolute items should honor the 
provides-containing-block property, for example, and using position: 
relative to provide a containing block will still work with the new scheme).

It also still leaves the door open for the position property to be 
deprecated at some point in the future, because the combination of 
provides-containing-block and the new positioning properties provide all 
the power that "position" does.

Stuart.

-- 
Stuart Ballard, Programmer
NetReach - Internet Solutions
(215) 283-2300, ext. 126
http://www.netreach.com/

Received on Wednesday, 26 March 2003 09:11:24 UTC