- From: Bert Bos <bert@w3.org>
- Date: Fri, 1 Mar 2002 10:24:43 +0100
- To: www-style@w3.org
James Aylard writes:
> Some discussion and testing on the CSS-Discuss list [1] has
> raised a question about how IE 5.x on the Macintosh renders 100% heights
> under the following conditions:
>
> * The style sheet specifies 100% height for the html and body elements
> * A div is placed within the html document, whose height is also set to
> 100%
> * In order to better see the div and to understand what is happening, a
> fixed width (say, 200px) is applied, as is a background color (say,
> #cccccc)
>
> For example:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>Div with 100% Height</title>
> <style type="text/css">
> html, body {
> height: 100% ;
> }
> div {
> height: 100% ;
> width: 200px ;
> background-color: #cccccc ;
> }
> </style>
> </head>
> <body>
> <div>This should have a height of 100%</div>
> </body>
> </html>
>
> In most browsers on which this was tested (at least IE 6/Win32,
> Mozilla 0.9.8, and Netscape 6.2.1), the div remains at a fixed height of
> 100% of the viewport (with some space for the body element's default
> margin/padding). In IE 5/5.1 for the Macintosh, on the other hand, the
> height of the div is precisely proportional (to the exact pixel) to the
> _width_ of the viewport. As the browser window is resized horizontally,
> the div's height grows or shrinks accordingly.
> I am unaware of anything in the CSS 2 spec that would dictate
> this behavior, and am tempted to think it a bug. Can anyone --
> especially someone from the IE 5/Mac team -- explain this behavior?
I think both behaviours are incorrect. Without putting 'position:
fixed' on at least one of the three elements, the '100%' won't refer
to the viewport's height. In fact, there is currently nothing for it
to refer to and it should just be interpreted as 'auto'.
Bert
--
Bert Bos ( W 3 C ) http://www.w3.org/
http://www.w3.org/people/bos/ W3C/INRIA
bert@w3.org 2004 Rt des Lucioles / BP 93
+33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Friday, 1 March 2002 04:24:44 UTC