html - 如何在表头和表体之间设置 bootstrap 3 边框的样式

标签 html css twitter-bootstrap

我正在 bootstrap 中对表格进行一些基本样式设置,并将单元格边框变为深蓝色。没什么特别的,而且是一张完全标准的 table ,但我终其一生都无法弄清楚如何设计 table 头和 table 身之间的边框。我已尽一切努力使这条线看起来与其他一切一样。

enter image description here

谁能告诉我如何创建一个在非灰色单元格上带有边框的 Bootstrap 表。我的 table 也有响应,但这似乎没什么区别

.table td, .table th {
    border: 1px solid #2980B9;
}

.table{
    border: 1px solid #2980B9;
}

  <div class="table-responsive">
    <table class="table">
      <thead>
        <tr>
          <th>1</th>
          <th>Table cell</th>
          <th>Table cell</th>
          <th>Table cell</th>
          <th>Table cell</th>
          <th>Table cell</th>
          <th>Table cell</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
        </tr>
        <tr>
          <td>2</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
        </tr>
        <tr>
          <td>3</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
          <td>Table cell</td>
        </tr>
      </tbody>
    </table>
  </div>

最佳答案

您应该像这样使用 Bootstrap 使用的选择器:http://jsfiddle.net/4tdS2

你的 css 可能看起来像这样:

.table { border: 1px solid #2980B9; }
.table thead > tr > th { border-bottom: none; }
.table thead > tr > th, .table tbody > tr > th, .table tfoot > tr > th, .table thead > tr > td, .table tbody > tr > td, .table tfoot > tr > td { border: 1px solid #2980B9; }

关于html - 如何在表头和表体之间设置 bootstrap 3 边框的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19306966/

相关文章:

javascript - 按下 ENTER 键时防止在 Textarea 中换行的代码不起作用

html - 如何使 float 扩展宽度?

twitter-bootstrap - Flexbox 固定标题,固定左侧导航流体内容区域

javascript - Excel 导出在 Firefox 上不起作用,但在谷歌浏览器中工作正常

javascript - JS - 在当前函数之上停止函数

javascript - 在表格行上 Accordion 切换但在特定单元格上阻止

css - 是否有 CSS 父级选择器?

php - 为什么 Php Media Gallery 不工作?

html - 居中内容 - 然后左对齐 Bootstrap 4

css - Bootstrap Stylesheet 仅适用于一个 div,但仍会影响其他 div