html+css tables - tr 的 border-bottom 与 td/th 的 border-right 重叠

标签 html css html-table border

这是我当前代码的示例:jsfiddle

问题是,表头和正文之间的深灰色线被单元格的右边距截断了。我想在列之间有一个边界,在标题和正文表之间有一个不间断的边距。

这是 HTML:

<table id="prazo">
  <thead>
    <tr>
      <th>month</th>
      <th> val </th>
      <th> val </th>
      <th> val </th>
      <th> val </th>
      <th> val </th>
      <th>val</th>
    </tr>
  </thead>
  <tbody>
    <tr class="srow">
      <td>January</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>January</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
    </tr>
    <tr class="srow">
      <td>January</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
      <td>$100</td>
    </tr>
  </tbody>
</table>

和CSS:

#prazo {
    font-family: 'Bitter', serif;
    width: 100%;
    border-spacing:0;
    border-collapse:collapse;
}

#prazo thead tr{
    height: 50px;
    background-color: #ffffff;
    font-weight:bold;
    border-bottom: 3px solid #7d7d7d !important;
}



#prazo td, th {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 14px;
    height: 30px;
    background-color: #ffffff;
    border-right: 3px solid #f6f6f6;
}

.srow td {
    background-color: #f2f2f2 !important;
}

#prazo th {
    font-size: 16px;
}

最佳答案

我能想到的最好的办法是: 将深色边框的宽度增加到 4px (border-right: 4px solid #7d7d7d;)
或者
将另一个边框的宽度减小到 2px(border-right: 2px solid #f6f6f6;)。

查看此 jsFiddle

这不是最好的答案,但它确实为您提供了坚实的深色边框,并在第 th 个单元格之间保留了较亮的边框。

关于html+css tables - tr 的 border-bottom 与 td/th 的 border-right 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19811488/

相关文章:

html - Bootstrap 面板看起来不正确

javascript - 这个 jQuery 淡入淡出画廊代码有什么问题?

javascript - fullpage.js slider 。绝对 block 的问题。 Chrome

html - Bootstrap 响应式导航

php - 我如何从另一个 PHP 页面创建并引入变量

php - 如何从 mysql 数组的值创建 html 表

php - 如何使用 php 和 mysqli 在一次事务中上传多个图像文件?

css - Angular如何在不向父组件中的td元素添加样式的情况下将子组件定位在中心

css - HTML 表 : Overflow-x scroll if no of columns are more

javascript - 在 div 中滚动到顶部