我想自定义Bootstrap条纹表的颜色...但仅其中一些颜色。换句话说,我不想进行全球性的改变。我只想在网站上的一个特定表格中自定义颜色。遵循以下两个问题:
我试图将表和CSS定义为:
<table class="table-condensed table-striped" id="info_envio">
#info_envio.table-striped>tr:nth-child(odd){
background-color:red;
}
但这是行不通的。
我觉得它一定很简单。请给我一点手吗?
我认为您tbody
在选择器和中缺少nth-of-type
。
#info_envio.table-striped>tbody>tr:nth-of-type(odd){
background-color:red;
}
较旧版本(低于v3.3.0)的Bootstrap可能会将背景颜色分配给该单元而不是该行,因此,如果上述方法不起作用,请尝试以下操作。
#info_envio.table-striped>tbody>tr:nth-child(odd)>td,
#info_envio.table-striped>tbody>tr:nth-child(odd)>th {
background-color: red;
}
从v3.3.0更改日志...
#13920:分配
background-color
给<tr>
元素,而不是分配给<th>/<td>
,.table-striped
以避免在响应表上破坏背景。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句