html - 表条带引导类不工作,但其他类正在工作
问题描述
我在一个角度项目中使用引导类创建了一个表。只有 table-striped 和 table-hover 类不工作,其余类如 table-primary 工作。而且我还没有写过一行 css 代码(没有覆盖问题)。我已经尝试了堆栈中的其他示例,但没有解决问题出在 tbody 上。我试过包括 tbody 标签但没有用。
<div class="container box" style="margin-top: 10px;">
<table class="table table-striped table-fit table-bordered table-hover">
<thead>
<tr>
<th>Item</th>
<th>Amount</th>
<th>Category</th>
<th>Location</th>
<th>Spent On</th>
</tr>
<tr *ngFor="let entry of expenseEntries">
<th scope="row">{{ entry.item }}</th>
<th>{{ entry.amount }}</th>
<td>{{ entry.category }}</td>
<td>{{ entry.location }}</td>
<td>{{ entry.spendOn | date: 'short' }}</td>
</tr>
</thead>
</table>
</div>
解决方案
您必须在标签内定义<thead>
和标签。<tbody>
<table>
tbody内的表格内容只会受官方文档.table-striped
中提到的class影响
推荐阅读
- javascript - 如何在 Mocha 异步单元测试中使用 afterEach?
- angular - 如何在使用多个 Promise 时知道所有 Promise 何时解决
- javascript - Javascript - 将事件侦听器添加到实时标签,但从事件侦听器中排除内部元素
- php - PHP exec,system,shell_exec 无法在 ubuntu 机器上使用 wget
- html - Style.css 在我编辑页面时会出错
- ruby-on-rails - 计数数组中的项目跨越 100 的数千条记录
- delphi - Delphi - 将记录作为窗口消息发送
- wpf - 数据网格行中文本的默认字体大小是多少?
- ios - FacebookShare 0.3.2 Swift ShareDialog 控制台错误
- c - setbuf() - printf() 和 write()