display:table在chrome与firefox中差异

display:table样式在不同浏览器中,造成了几个像素的偏差。
css:

    .tbodyContent span{
        text-align: center;
        display: table-cell;
        vertical-align: middle;
    }
    .tbodyContent>div{
        display: table;
    }
    .trDiv:nth-child(even){
      height: 145px;
      width: 1080px;
      background-color:#B6D7A8
    }
    .trDiv:nth-child(odd){
      height: 145px;
      width: 1080px;
      background-color:#7F6000
    }

html:

<div class="tbody" style="height:580px;">
        <div class="tbodyContent" style="height: 100%;">
            <div class="trDiv">
              <span style="width: 15%;">1</span>
              <span style="width: 40%;">2</span>
              <span style="width: 30%;">3</span>
              <span style="width: 15%;">4</span>
            </div>
            <div class="trDiv">
              <span style="width: 15%;">1</span>
              <span style="width: 40%;">2</span>
              <span style="width: 30%;">3</span>
              <span style="width: 15%;">4</span>
            </div>
            <div class="trDiv">
              <span style="width: 15%;">1</span>
              <span style="width: 40%;">2</span>
              <span style="width: 30%;">3</span>
              <span style="width: 15%;">4</span>
            </div>
            <div class="trDiv">
              <span style="width: 15%;">1</span>
              <span style="width: 40%;">2</span>
              <span style="width: 30%;">3</span>
              <span style="width: 15%;">4</span>
            </div>
        </div>
    </div>

同样一段代码在chrome 66 版本中:
图片描述

如上图所示,高度并不是145px,而是144px

在firefox中:
图片描述

如上图所示,高度与样式中145px一致。

请问如何操作chrome 使得高度不会发生缩水现象?

阅读 1.9k
1 个回答

chrome测试了一下未复现你的问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题