我的 Rails 应用程序中有下表:
<table class='table table-bordered table-hover table-striped'>
<thead>
<tr>
<th>ID</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr class='danger'>
<td><%= order.id %></td>
<td><%= order.status.name %></td>
</tr>
</tbody>
</table>
并且带有“危险”类的行不会改变颜色。但是,如果我使用“成功”类,它会正确更改。
我正在使用 twitter-bootstrap-rails gem。
最佳答案
twitter-bootstrap
gem 目前正在使用 bootstrap v 2.3.2
。
根据 Bootstrap version 2.3.2 Documentation For Tables以下是可用的行类:
Optional row classes
Use contextual classes to color table rows.
.success Indicates a successful or positive action.
.error Indicates a dangerous or potentially negative action.
.warning Indicates a warning that might need attention.
.info Used as an alternative to the default styles.
这就是为什么 .success
有效但 .danger
无效的原因。
我想您正在寻找 .error
类。
关于css - Bootstrap 危险类不适用于表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23922055/