Mixing percentage height and min-height

Just got an interesting "bug" in KDE bugzilla.

You have:

div { min-height: 100% }

and two nested divs
<body>
<div><div> </div></div>
</body>

The result is that inner div is not 100% of body. 

The reason is because 'height' is not explicitly defined for the outer div, so 
the percentage in the inner is calculated to 'auto'.

CSS 2.1 #10.5: "<percentage> Specifies a percentage height. The percentage is 
calculated with respect to  the height of the generated box's containing 
block. If the height of the containing block is not specified explicitly 
(i.e., it depends on content height), and this element is not absolutely 
positioned, the value computes to 'auto'. "

Does this mean a percentage height never is calculated from min-height or only 
when the containing block is constrained by the minimum height?

The result of the last rule is kinda odd as percentage height could suddenly 
be lost when more content is added to containing block.

--
The mentioned case is "easy" as you _could _define a min-height percentage to 
always be calculated from a min-height of a parent if height is auto, but if 
you have:

.parent { min-height: 100px }
.child { height: 50% }

What is the effect on .child?

--
Repeat question for max-height.


`Allan

Received on Wednesday, 11 October 2006 18:21:23 UTC