Re: height property behavior

On Thu, 3 Jul 2003, Brian V Bonini wrote:
> When setting the height property one would expect a value of 100% to
> extend the length of the entire page but in fact it only spans the
> length of the initial viewport. So, if I have a box who's content
> extends beyond the initial viewport with a background-color property set
> the color will stop once the user scrolls down beyond the viewport.
> Is this the intended behavior of the height property with a 100% value
> or is this a matter of non-compliancy? Behavior on this matter is
> consistent among several browsers I tested with.

The initial containing block is the viewport, but you can make it the root
element just by saying:

   :root { position: relative; }

...and then the 'height' property on absolutely positioned elements other
than the root element will be relative to the root element instead of the
viewport. Not sure how well that is supported. Try 'html' instead of
':root' if you want it to work in WinIE.

Note: CSS2 disagrees with the above. This is one of the current proposed
changes to CSS2.1. This area of the spec is not without controvery,
though, so I don't guarentee that the final text will agree with me. :-)

Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.                         `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 4 July 2003 07:55:11 UTC