html - CSS 表格行边框在 chrome 和 IE 中无法正确显示

标签 html css border css-tables

我创建了一个带有底部行边框的简单表格。在 Firefox 中它运行完美,边框显示在整行中,但在 Chrome 和 IE 10 中它只显示在部分行中:

<div style="display:table; border-collapse: collapse; width: 100%">
<div style="display:table-row; border-bottom: 1px solid black;"> 
    <div style="display:table-cell;">a </div>
    <div style="display:table-cell; width: 15%;">b </div>
</div>
<div style="display:table-row; border-bottom: 1px solid black;"> 
    <div style="display:table-cell; width: 15%;">a </div>
    <div style="display:table-cell; width: 15%;">c </div>
</div>
<div style="display:table-row; border-bottom: 1px solid black;"> 
    <div style="display:table-cell;">a </div>
    <div style="display:table-cell; width: 15%;">b </div>
    <div style="display:table-cell; width: 15%;">c </div>
</div>

</div>

fiddle link

也许有人知道如何解决这个问题?

最佳答案

添加空的 div

<div style="display:table; border-collapse: collapse; width: 100%">
  <div style="display:table-row; border-bottom: 1px solid black;">
    <div style="display:table-cell;">a</div>
    <div style="display:table-cell; width: 15%;">b</div>
    <div style="display:table-cell; width: 15%;"></div>
  </div>
  <div style="display:table-row; border-bottom: 1px solid black;">
    <div style="display:table-cell; width: 15%;">a</div>
    <div style="display:table-cell; width: 15%;">c</div>
    <div style="display:table-cell; width: 15%;"></div>
  </div>
  <div style="display:table-row; border-bottom: 1px solid black;">
    <div style="display:table-cell;">a</div>
    <div style="display:table-cell; width: 15%;">b</div>
    <div style="display:table-cell; width: 15%;">c</div>
  </div>

</div>

注意:尚未在 IE 上测试。

关于html - CSS 表格行边框在 chrome 和 IE 中无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27526582/

相关文章:

html - 如何纠正 div、 float 和边框对齐问题

javascript - 如何使用reactjs样式在CSS中设置完整的背景图像?

css - 如何在 CSS 中使用图像作为边框

button - 如何为 flutter 按钮添加边框?

css - 从中心偏移两个 div,在容器 div 内

javascript - 页面刷新后不加载 css 和 js 文件

html - Bootstrap 4 div 高度不扩展以适合内容

css - 无法缩短此 li 标签的高度

javascript - 如何隐藏滚动(溢出:hidden)?

html - 如何在订单列表中对齐 div 和关于 <ul> 边框样式