W3C home > Mailing lists > Public > www-style@w3.org > August 2000

Re: POSITION: relative-to?

From: Clover Andrew <aclover@1VALUE.com>
Date: Mon, 28 Aug 2000 23:44:20 +0200
Message-ID: <5F78AA062F6AD311A59000508B4AAF6D092B9E@pcs02>
To: "'www-style@w3.org'" <www-style@w3.org>
Maury Markowitz <maury@sympatico.ca> wrote:

> That sounds like an excellent idea all on it's own.  Still 
> I'm not sure the proposal is really the same thing

Yeah... I love the idea of "flow" as presented in
http://www.w3.org/TR/NOTE-layout, but I think it's somewhat
limited by its aim to reproduce frames, in the same way that
"float" was limited by its aim to reproduce left/right img
alignment. I want to be able to write my HTML in a logical,
linear fashion (both for maintainability and to engender
graceful degradation), and then use some manner of styling
elsewhere to arrange everything on the page - not just for
fixed-to-viewport elements (frame-like), but also fixed-to-
page elements (table-like).

Absolute positioning achieves this, but only when the elements
involved are either all fixed-pixel-size, or all dynamically
resizable. In practice this is never the case, since all
text is dynamically sized and all single images (as opposed to
background images which can tile to fill any space) are of
a fixed size. Very few web sites are all text or all image,
although many sites decrease their usability by trying to
fix the size and width of their text to get around this.

The only real way of mixing fixed and dynamic at the moment is,
sadly, table layouts. This is not easy to implement because
of table formatting bugs in the Big Two, and because HTML
tables just weren't designed for complicated layouts. Absolute
positioning combined with float left/right and tables could
provide quite good layout features, except that the Big Two
go horrendously wrong when you start combining them, and
Netscape 4 is very likely to crash. Hell, Netscape 4 seems
guaranteed to crash if you so much as consider putting a
positioned element inside another one, which makes all but
the simplest layouts impossible.

> Basically the issue I'm trying to solve is really just a
> measurement issue. The issue is to create a new measurement
> "world" (co-ord system) that is based on any other part of
> the document.

This is extremely difficult, natch. (Which is why it's a
problem you're trying to solve, not a ready-made solution
you're suggesting, of course!)

Anyone who's tried using JavaScript to set the positions of
absolutely-positioned elements of non-fixed sizes using the
non-standard object model features in IE and Netscape will
know how complicated the formulae for x and y positions,
width and height, can end up being. And that's in a procedural
language. How to do something like this in a strictly
declarative language like CSS? Seems to me you'd have to start
adding variables and evaluation to the mix, something like:

  body       { width: $all }
  .navbox    { position: absolute; top: 0; right: $all;
               width: $navw; height: 100pix }
  .navbot    { position: absolute; top: 100pix; right: $all-1em;
               width: $navw-2em; }
  .pullquote { position: absolute; top: min(100pix, 8em) }

...and so on. Essentially you'd be using $symbols to add
constraints to the layout and letting the browser work out
what actual measurements fit (if any!). This is obviously very
complication, not backwards-compatible, and puts a big strain
on the browser. But short of forgetting CSS for layout and
inventing something else, I can't see any other solution. To be
honest, I find CSS's flow/float/auto-size/absolute/relative
layout model confusing enough already, never mind the
infuriating implementation problems.

If you come up with any elegant solutions to this one I'd
personally love to hear about it!

For now, I'm going back to my tables. :-(

Andrew Clover
Technical Support
Received on Monday, 28 August 2000 17:48:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:55 UTC