See jsFiddle.

<table>
  <tr>
    <td>
      <div>
        Hello World
      </div>
    </td>
  </tr>
</table>

html, body {
  height:100%;
  background-color:steelblue;
  margin:0;
}

table {
  height:100%;
  border:1px;
}

td {
  border:1px;
}

tr {
  background-color: green;
}

div {
  background-color:salmon;
  height:100%;
}

Prior to Chrome 50, a table with height 100% would also implicitly apply height 100% to it's table cells.

在Chrome 50之前,高度为100%的表格也会隐式地将高度100%应用于其表格单元格。

This has been a longstanding bug in Firefox and IE versions < 11. Chrome and Safari have always passed the implicit percentage height onto the cells.

这是Firefox和IE版本<11中长期存在的错误.Chrome和Safari总是将隐含的百分比高度传递给单元格。

What is the correct behaviour according to the specifications? Has this been introduced by design?

根据规格,正确的行为是什么?这是由设计引入的吗?

Edit: Chromium Bug Report

编辑:Chromium Bug报告

2 个解决方案

#1


1

This appears to be the same question as this Chromium issue, which was closed over 2 months ago. According to the comments there, the new behavior in Chrome 50 is "more spec compliant".

这似乎是与这个Chromium问题相同的问题,该问题已于2个月前结束。根据那里的评论,Chrome 50中的新行为是“更符合规范”。

So, to answer your question, it would appear this is intentional, and is considered (at least by the Chromium developers) to be the correct behavior according to the specifications.

因此,为了回答您的问题,这似乎是有意的,并且根据规范被认为(至少由Chromium开发人员)是正确的行为。

The solution, naturally, is to just explicitly set the cell's height to 100%.

当然,解决方案是将单元格的高度明确设置为100%。

更多相关文章

  1. 对于表格数据,什么渲染更快,CSS或?
  2. 两个堆叠DIV的顶部DIV如何影响另一个DIV的高度
  3. CSS:浮动时忽略div高度
  4. DiggBar如何基于不在其域上的内容动态调整其iframe的高度?
  5. php导入导出excel表格
  6. PHP联系表格给用户发送随机确认号码
  7. 在phpword中如何在表格中新建行?
  8. 当excel表格单元格的格式是日期格式非文本格式的时候,phpexcel 应
  9. 在mysql shell中显示没有表行的查询结果(非表格输出)

随机推荐

  1. 本地方法中printf如何传给java--java系统
  2. Maven:主线程中的NoClassDefFoundError
  3. spring boot返回date类型
  4. 跨站脚本专题(XSS)
  5. JavaScript三种弹出框(alert,confirm和prom
  6. 是否有缩放因子方法用于Android的多分辨
  7. 黑马程序员 Java中根据YYYY-MM-DD格式的
  8. 用java画跳棋棋盘
  9. 【Effective Java】条30:使用枚举代替int
  10. java中excel导出包括合并单元格和单元格