W3C home > Mailing lists > Public > www-style@w3.org > July 2003

Re: height property behavior

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 4 Jul 2003 04:55:31 -0700 (PDT)
To: Brian V Bonini <b-bonini@cox.net>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <Pine.LNX.4.56.0307040452590.9100@dhalsim.dreamhost.com>

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"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 4 July 2003 07:55:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:22 GMT