Re: Relative positioning

> > I mean, with absolute positioning, elements are positioned
> > completely independently as if they have no knowledge of each other,
> > and with relative positioning, elements are positioned only relative
> > to the normal flow. This effectively means that the two types of
> > positioning can't really be used together very well, and what seems
> > to be missing is a mechanism for positioning one element relative to
> > an absolutely positioned (and perhaps named) element, thereby
> > avoiding potential overlap problems.
>
> Can you give us a more concrete example?

That's not too hard. I've had this problem many times,
usually when I want to create some kind of popup.

A conrete example is the menu at microsoft.com. (with IE4+)
The menubar is part of the flow.
But the menupopups are absolute positioned.
The topleft corners of the menupopups must be equal to the bottom-left
corner of the menubar items.

The problem is that this is impossible to code. (using DOM)
The DOM does not want to supply interfaces for run-time properties like the
absolute positions of relative positioned elements.

The maximum flexibility would be given, if CSS would support the following:
- which element should the AP coordinates be relative to.
- at what position of this element (similar to background-position)
  for a menubar item this woud be 0% 100%
- at what position of the AP element (also similar to background-position)
  for a menupopup this would be 0% 0% (the default)

I don't think I made myself clear here.
Does someone know some nice words for the various positions?

Reference element
+------------------------------+
|                  :           |
|     AP element   :           |
|     +------------:-----------------+
|     |            :           |     |
|..................+.................|
|     |            : Reference |     |
|     |            : point     |     |
|     |            :           |     |
+-----|------------:-----------+     |
      |            :                 |
      +------------------------------+

Setting both positions to 50% 50% would put the AP element in the center of
the reference element.

I agree with Rick Johnson that such functionality is almost required if you
need to use abs. pos. in a document which consist of mainly static
positioned elements. (ie. almost all documents on the WWW)

Sjoerd Visscher

Received on Tuesday, 1 February 2000 08:23:41 UTC