gpt4 book ai didi

html - 只有边框行和外部表 Bootstrap

转载 作者:行者123 更新时间:2023-12-04 14:53:53 24 4
gpt4 key购买 nike

我需要用 bootstrap 删除表格的垂直边框,如下所示

enter image description here

我试过了

 <table class="table no-footer worker-data table-bordered"....
.table td, .table th {
border: none;
}

但是结果

enter image description here

最佳答案

采用以下方法。

  • 清除行中第一个子项的右边框。
  • 清除最后一个 child 的左边框。
  • 清除所有其他子项的左右边框 ec=x 除了行的第一个和最后一个子项。

工作示例

.table td:first-child, .table th:first-child {
border-right: none;
}
.table td:last-child, .table th:last-child {
border-left: none;
}

.table td:not(:first-child):not(:last-child),
.table th:not(:first-child):not(:last-child) {
border-right: none;
border-left: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<div class="container">
<table class="table no-footer worker-data table-bordered">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@example.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@example.com</td>
</tr>
</tbody>
</table>
</div>

关于html - 只有边框行和外部表 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68527470/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com