高度 属性 是否应应用于 table 行组?
Should the height property be applied to table row groups?
我发现浏览器之间的另一个区别,即它们如何处理 tbody
元素上的 height
。
<table>
<tbody style="height:150px">
<tr>
<td style="border:1px solid">This is a test</td>
</tr>
</tbody>
</table>
Chrome忽略高度,FF和IE11不忽略
那么,哪些人做对了?我搜索了一下,没有找到权威的答案。
Visual formatting model details 说 height
Applies to: all elements but non-replaced inline elements, table columns, and column groups
没有进一步的限制,但是 W3C: Tables 说
CSS 2.1 does not define the meaning of 'height' on row groups
(其中行组是 thead、tbody 和 tfoot 元素。)这只是一个灰色区域吗?
So is this simply a grey area?
propdef 暗示 height
确实适用于行组,但它究竟有什么影响是未定义的。应用的 属性 并不总是需要对布局产生明显的影响;在某些情况下它可能什么都不做。在 所有 情况下什么都不做,就像 Gecko 等人的情况一样,是否是一个有效的解释可能有待商榷。规范的要点是 UA 是否符合 CSS2 不受它选择如何处理行组上的 height
的影响。所以我对这个问题的回答是 "probably."
话虽如此,但 css-tables-3 的行为仍未定义,它仍在开发中,尽管 the resolution appears to be to match Firefox's behavior (see this issue)。
由于该行为目前不可互操作,作者不应依赖于对行组使用 height
。
我发现浏览器之间的另一个区别,即它们如何处理 tbody
元素上的 height
。
<table>
<tbody style="height:150px">
<tr>
<td style="border:1px solid">This is a test</td>
</tr>
</tbody>
</table>
Chrome忽略高度,FF和IE11不忽略
那么,哪些人做对了?我搜索了一下,没有找到权威的答案。
Visual formatting model details 说 height
Applies to: all elements but non-replaced inline elements, table columns, and column groups
没有进一步的限制,但是 W3C: Tables 说
CSS 2.1 does not define the meaning of 'height' on row groups
(其中行组是 thead、tbody 和 tfoot 元素。)这只是一个灰色区域吗?
So is this simply a grey area?
propdef 暗示 height
确实适用于行组,但它究竟有什么影响是未定义的。应用的 属性 并不总是需要对布局产生明显的影响;在某些情况下它可能什么都不做。在 所有 情况下什么都不做,就像 Gecko 等人的情况一样,是否是一个有效的解释可能有待商榷。规范的要点是 UA 是否符合 CSS2 不受它选择如何处理行组上的 height
的影响。所以我对这个问题的回答是 "probably."
话虽如此,但 css-tables-3 的行为仍未定义,它仍在开发中,尽管 the resolution appears to be to match Firefox's behavior (see this issue)。
由于该行为目前不可互操作,作者不应依赖于对行组使用 height
。