Re: POSITION: relative-to?

On Sat, 26 Aug 2000, Maury Markowitz wrote:

>   Another very annoying problem I've run into with CSS-positioning is that I
> find that the _majority_ of the "boxes" I define I want to lay in some
> obvious relationship to some other box.  For instance in my particular case
> I want my nav bar to lie on the left of the main body (which is also below
> the header and above the footer).
> 
>   One solution to this is to put the "next to" box at the front of the code
> inline with the main body and then use FLOAT:left to position it. However my
> whole reason for switching to CSS was to allow the code for the nav bar to
> lie at the _bottom_ of my code so that in the degrading case the user
> wouldn't have to wade through all my links before going onto the guts of the
> article (it was viewing this exact problem in Lynx that got me into CSS).
> 
>   So instead I place the body and nav bar inside two divs, and then "move"
> the nav bar up. But of course to do this I need to have a box to place it
> inside of, which means that I have to wrap both inside yet another DIV. This
> is somewhat annoying, and worse, I find that it makes me very confused about
> style cascading.
> 
>   Is there any possibility that CSS could include the ability to position
> blocks in relation to another? For instance, (forgive the syntax) what about
> POSITION: relative-to(#anotherBlock).
> 
>   Or am I just missing something blindingly obvious and there's a way to
> simplify my current layout as is?

I don't want to discourage you (on the contrary, please continue asking
for these features and some day the time may be ripe to get them
implemented), but this also has been asked before :-)

The note 

    http://www.w3.org/TR/NOTE-layout

proposes a method in which you first create a page template, independent
of the document, and then for each element in the document you specify
into which part of the template it goes.

It is not currently on the schedule for CSS3 (though CSS3 will have
something that is related: a simple template for printed pages, but that
won't solve your problem). But keep asking. You may convince enough people
eventually.

Btw., maybe you can solve your problem with fixed positioning. It is not
implemented very well yet, but it is coming. I have a simple example on
the http://www.w3.org/Style page (for which you will need Opera4, MacIE5
or a recent preview of NS6/Mozilla), and there is also an example in the
CSS2 spec.


Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Sunday, 27 August 2000 09:25:20 UTC