我正在尝试更改表格的颜色背景,但它只更改除以 2 的行。我该如何更改其余部分?
我附上表格的代码和相关的 CSS。
CSS
.table-striped{
background: #f8fcff !important;
.label {
width: 44px;
height: 16px;
padding-top: 3px;
}
]
最佳答案
您需要使用第 n 个 child 。
这将允许您编辑要设置样式的行
table tr:nth-child(odd)
{
background:red;
}
table tr:nth-child(even)
{
background:blue;
}
关于html - 表格背景颜色每两行变化一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22758434/