【发布时间】:2021-05-18 17:16:45
【问题描述】:
我正在使用 Bootstrap 5.0 CSS,并尝试使用我自己的一些 CSS 制作具有自定义单元格颜色的表格。 color 属性工作正常,但是当我尝试使用 background 属性更改背景颜色时,Bootstrap 会忽略该规则。有谁知道如何解决这个问题?
我的代码:
td.colorfy {
background: blue;
color: white;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-bordered">
<tr>
<td class="colorfy">cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
【问题讨论】:
-
我建议阅读the documentation for tables,因为那里有关于如何计算背景颜色的信息。您可能希望使用其中一个 Bootstrap 类来进行更改。
标签: css twitter-bootstrap html-table bootstrap-5