Bugzilla – Bug 15892
What's the baseline of an inline table with no rows?
Last modified: 2012-12-04 00:50:49 UTC
Reported by Anton Prowse
The baseline of an 'inline-table' is defined in 10.8.1 to be the baseline of the first row of the table. But what if it doesn't have any rows? We should probably define it to mean the bottom margin edge of the wrapper box in that case, to match the behaviour of 'inline-block'.
This bug is related to Bug 15891
This proposal would partially resolve Bug 15890
Browser compat info:
Add a rowless table as the first item in an table cell, and see how the table cell's baseline is determined. According to 17.5.3:
# The baseline of a cell is the baseline of the first in-flow
# line box in the cell, or the first in-flow table-row in the
# cell, whichever comes first. If there is no such line box or
# table-row, the baseline is the bottom of content edge of the
# cell box.
Experiments suggest that Firefox constructs an anonymous table-row and table-cell in the empty table (even though the algorithm in the spec wouldn't create any). It then aligns that row as specified.
WebKit, on the other hand, skips over the row-less table when trying to determine a baseline for the cell.
Can I see the testcase you used for comment 3?
(In reply to comment #4)
> Can I see the testcase you used for comment 3?
In Webkit, the two "foo"s have their baselines aligned. In Firefox, the first "foo"'s baseline is lined up with the bottom of the table.
Gecko does not have a table row there. It just treats the "first line baseline" as being always available from a table, which is probably just wrong per spec. File a bug, please? ;)
It's not wrong per spec, it's undefined. We can go either way.
I'd prefer to have a no-row table produce a baseline, just like we've defined no-item flexboxes to produce a baseline.
Well, spec says to look for the first line box or table row, and that would be the "foo" here, when looking for the baseline of a cell. So it looks defined per spec to me.
The baseline of an _inline_ table is indeed undefined. But that's somewhat orthogonal.
Though obviously I would prefer it if we simply defined the baseline of tables and used it both places.... assuming the same baseline works in both cases. Note that for blocks we have different behavior for inline-block and block (last line vs first line).
Ah, so actually the test in Comment 3 and onwards isn't actually useful for observing if/how UAs determine the baseline of a table with no rows, since the baseline of a cell is specified to depend on descendant table rows but not on the table itself.
And in any case, the baseline of a table isn't what we're interested in here anyway; it would have merely been an interesting data point. (Flexbox is the spec which cares about that, not CSS21.) This bug is about the baseline of an /inline/-table.