html - 表格边框不显示

标签 html css less

我正在尝试设置表格样式,但未显示边框。我以前从未发生过这种情况,所以我不确定该怎么做。

这是我的 table :

<table class="table">
  <thead>
    <tr>
      <th>Dessert (100g serving)</th>
      <th>Calories</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Dessert (100g serving)</td>
      <td>Calories</td>
    </tr>
  </tbody>
</table>

这是我的 less:

@dark-text: rgba(0,0,0,0.87);
@dark-text-secondary: rgba(0,0,0,0.54);
@dark-text-disabled: rgba(0,0,0,0.26);

.table {
    z-index: 10;

    thead {
        tr {
            border-bottom: 3px solid @dark-text-disabled;
            z-index: 10;

            th {
                color: @dark-text-secondary;
                z-index: 10;
            }
        }
    }

    tbody {
        tr {
            border-bottom: 3px solid @dark-text-disabled;
            z-index: 10;

            td {
                z-index: 10;
            }
        }
    }
}

http://codepen.io/anon/pen/JdOaVO

最佳答案

border-bottom 规则移动到 thtd 标签或使用 collapsing border model (border-collapse: collapse;) 用于 .table

.table {
    border-collapse: collapse;
}

http://codepen.io/anon/pen/BNmOgg

关于html - 表格边框不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31040422/

相关文章:

html - 如何在主菜单悬停时打开子菜单?

css - 将 Less 和 CSS 文件与 grails lesscss-resource 捆绑在一起

java - Java 项目的 LessCSS/JS 编译器和压缩器

javascript - 如何使用 href 在选项卡之间切换?

android - 纯 HTML 的滚动问题和溢出 :auto in native Android browser

javascript - 修改表单元素所需的内容

php - 显示外部网站的某些部分并修改 HTML/CSS

html - Css transform flip 向后翻转和 IE 问题

向小部件添加内容时的 HTML + CSS 间距问题

css - 减去 : find the function to get a color X from color Y