https://getbootstrap.com/docs/5.1/content/tables/#overview
如何覆盖和修改标题下面的引导程序5 table边框?
我想通过简单的CSS覆盖来实现这一点,而不是使用SASS。
我尝试了以下几点,但没有产生任何效果:
.table > thead > tr > th {
border-bottom-color: red !important;
}发布于 2021-10-11 14:01:14
由于某种原因,我只能通过指定带宽度、样式和颜色的整个border-bottom属性来覆盖现有的样式,并且宽度最小为2px。我还简化了选择器,并删除了!important。
.table thead th {
border-bottom: 2px solid red;
}<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF" crossorigin="anonymous">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First</th>
<th>Last</th>
<th>Handle</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Heretic</td>
<td>Monkey</td>
<td>Heretic Monkey</td>
</tr>
</tbody>
</table>
发布于 2022-01-18 15:15:55
看看https://github.com/twbs/bootstrap/issues/35342
下面是可以删除边框的CSS
.table > :not(:first-child) {
border-top: 0;
}然后你可以应用你自己的造型。
发布于 2022-05-26 10:57:04
有几个解决方案你可以尝试。
解决方案1.
.table > :not(:first-child) {
border-top: 0;
}解决方案2.
另一个是将table-borderless类添加到表中,如下所示
<table class="table table-dark table-borderless">
...
</table>然后,您可以将自定义边框类分配给该表。
例如:
#myTable table,
thead,
tbody,
tr {
border-bottom: 1px solid black !important;
}实际上,在我的例子中,第一种解决方案不起作用,但是通过使用第二种解决方案,我可以应用我的自定义边界css。
希望这对某些人也有帮助。
https://stackoverflow.com/questions/69526898
复制相似问题