Re: Why no compositional positioning?

On Mon, Mar 16, 2009 at 9:28 AM, Thomas Davie <tom.davie@gmail.com> wrote:
> Thanks, okay, I don't yet fully understand what's going on here then.  I
> have an example which I expect to produce a table using divs (yes, I know,
> this is as bad as producing divs using tables, but it's a good example of
> trying to achieve a certain layout and apparently being stymied by css:
>
> http://www.cs.kent.ac.uk/people/rpg/tatd2/test.html
>
> I had assumed previously that absolute positioning was positioning elements
> relative to the top-left of the document window, causing the absolutely
> positioned elements to not be part of their parent div, and hence the
> relatively positioned ones to have a height of 0.  Apparently though this is
> not what's happening.

Absolute positioning removes an element from the document flow.  This
means, among other things, that parent elements no longer use it to
determine their height; they no longer 'contain' the abspos element.
Thus, if you abspos all the children of an element, that element no
longer has *any* in-flow content, and collapses to 0 height.

You're not seeing a contradiction, you're just seeing multiple effects
in play.  Note that even in your example it's clear that the abspos
elements are positioning themselves based on their parent, as the
elements are offset from each other by several pixels, due to the
borders on the collapsed parents making their height non-zero.

There are a number of tutorials on positioning on the web; I'd suggest
reading a few to get a better grasp on the details of CSS-based
layouts.

~TJ

Received on Monday, 16 March 2009 14:45:40 UTC