L. David Baron wrote:
On Saturday 2004-03-27 11:51 +0100, Jens Tinz wrote:
The CSS specification (at http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-height) says
this about height properties with a percentage:


"Specifies a percentage height. The percentage is calculated
with respect to the height of the generated box's containing
block."

The next sentence is important:


  If the height of the containing block is not specified explicitly
  (i.e., it depends on content height), the value is interpreted like
  'auto'.

That's true in this case.

This is also true for <body>. So without an exception for it, the CSS part of the following code would be ignored. This is neither the expected result nor how Mozilla and IE handle it.

<style type="text/css">
  #top { height: 50% }
  #bottom { height: 50% }
</style>

<body>
 <div id= "top"> top </div>
 <div id= "bottom"> bottom </div>
</body>

So we need to assume an exception for <body>.


Your reasoning also assumes that heights given in percentages do not count as explicitly set heights. And that the height of the divs change with their content. This would make it impossible to do resizeable, nested layouts. Now have a look at the following code:

<style type="text/css">
  #top { height: 50% }
  #bottom { height: 50% }
  #nested { height: 50% }
</style>

<body>
 <div id= "top"> top </div>
 <div id= "bottom">
  bottom
  <div id= "nested"> nested </div>
 </div>
</body>

According to your interpretation of the spec, the CSS for
<div id= "nested"> should be without effect. Again, this
is not what happens in IE or Mozilla.

It gets more interesting when you make the contents of
<div id= "top"> and <div id= "bottom"> overflow.
<div id= "bottom"> grows with the content and <div id= "top">
doesn't.


All in all it looks as if the specification is poorly thought out. Mozilla seems to seek a compromise between user expectation and specification that doesn't really work out. _______________________________________________ mozilla-layout mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-layout

Reply via email to