Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何以不太具体的方式更改带条引导表?_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 如何以不太具体的方式更改带条引导表?

Html 如何以不太具体的方式更改带条引导表?,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我想更改引导表条纹的颜色。我读过这个问题:。因此,我可以更改它,例如: .table-striped > tbody > tr:nth-child(2n+1) > td, .table-striped > tbody > tr:nth-child(2n+1) > th { background-color: red; } 但是,我的应用程序需要为“选定行”使用不同的颜色。因此,我有一个名为“selectedRow”的CSS类,我们将其添加到所选的

我想更改引导表条纹的颜色。我读过这个问题:。因此,我可以更改它,例如:

.table-striped > tbody > tr:nth-child(2n+1) > td, 
.table-striped > tbody > tr:nth-child(2n+1) > th 
{
    background-color: red;
}
但是,我的应用程序需要为“选定行”使用不同的颜色。因此,我有一个名为“selectedRow”的CSS类,我们将其添加到所选的
tr
。该物业为:

.selectedRow td 
 {
    background-color: blue;
    color: black; 
}
我需要的是,对于所选行,背景颜色优先于引导表。也就是说,对于我添加css类selectedRow的
tr
,我希望它们是蓝色的,而不是红色的。请注意,我不能使用
!重要信息
此处(这是有原因的)


那么,有没有其他方法可以改变引导表的条带化,使selectedRow css类优先

以下是表中的代码。less:

.table-striped {
  > tbody > tr:nth-child(odd) {
    > td,
    > th {
      background-color: @table-bg-accent;
    }
  }
}
因此,您可以使用:

.table-striped > tbody > tr:nth-child(odd) > td {
   background-color: #819bbf;
  color: black;
}

您必须比引导样式更具体

例如:

.table-striped>tbody>tr.selectedRow:nth-child(odd)>td,
.table-striped>tbody>tr.selectedRow:nth-child(even)>td {
    background-color: #819bbf;
    color: black; 
}

我希望您能理解。

您是要选择(更改背景色)每行多行,还是只给预定义行添加背景色?类似这样的内容?你好也许我不清楚。如果我按照您的建议做,我确实会更改Bootstrap table.striped,但是我将无法使用“selectedRow”类更改backgrlound颜色,因为优先级将与Bootstrap类一致。我不能使用
!重要信息
。Thanks@MarianoMartinezPeck请看我对你的问题的评论,我想我们对你的问题有点误解。谢谢!这正是我要找的。它工作得很好。