Re: Percentage Height of a Replaced Element in a Table Cell

On 8/7/12 5:19 PM, Robert Hogan wrote:
> I believe IE and Opera are correct here: "The percentage is calculated
> with respect to the height of the generated box's containing block."

The CSS2.1 spec doesn't sanely define the containing block of table 
cells.  The definition in 10.1 is completely nonsensical for cells, 
because per that definition the containing block for cells would be the 
table wrapper box, which doesn't match the behavior of any UA.

In Gecko, in particular, the containing block of a cell is the row that 
cell is a child of, I believe.

But in any case, the situation you're asking about is explicitly covered 
in CSS 2.1 section 17.5.3:

    CSS 2.1 does not define how the height of table cells and table
    rows is calculated when their height is specified using percentage

So asking which is "correct" is pointless: the spec explicitly allows 
any behavior you want here.


P.S.  The one thing CSS2.1 does say, also in 17.5.3, is:

   In CSS 2.1, the height of a cell box is the minimum height
   required by the content.

which on the face of it means that anything less than 50px is incorrect 
in your testcase, though the percentage value bit might mean that the 
above sentence also doesn't apply, perhaps.

Received on Tuesday, 7 August 2012 21:31:03 UTC