【问题标题】:Bootstrap - Can't get "table-striped"Bootstrap - 无法获得“表格条纹”
【发布时间】:2018-12-09 01:00:45
【问题描述】:

我正在使用 table-strippedTwitter Bootstrap

我可以通过悬停来定位任何其他元素,没有table-striped 一切都很好,但是当我使用table-striped 时,某些元素无法激活。

原因如下:table-striped

You can see on JSFiddle for demo

我该如何解决这个问题?

【问题讨论】:

  • “确保”是什么意思?

标签: javascript html twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

这是因为 CSS 的特殊性。

增加您的 CSS 选择器特异性值或使用 !important 如果您懒得覆盖引导 CSS 选择器。

table.table.table-striped tr.myTip td {
 background: red;
}

.myTip td {
 background: red !important;
}

Demo

【讨论】:

  • 我们怎样才能使除了选中的颜色褪色?
  • 我不明白,你到底是什么意思?
  • 是否可以在不选择的情况下降低其他人的不透明度?只有它只会被选择为红色。其他的不透明度会是“0.5”有可能吗?
  • 你可以在你的表中添加类并且不透明 td 不是 .myTip
【解决方案2】:

实际上你的小提琴没有加载 bootstrap.css 文件。

table-striped 是一个引导类,但它没有加载到您的应用程序中,因此您为 table-striped 类创建了一个 css

.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>th {
  background-color: #e1e1e1;
}

通过在应用程序中加载引导文件,你只需要改变css选择器

.myTip > td, .myTip > th {
  background-color: red;
}

这里是Demo 链接

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-19
    • 2014-01-16
    • 2015-07-27
    • 2018-03-31
    • 1970-01-01
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    相关资源
    最近更新 更多