我想创建一个html表,我只想选择不属于thead且没有某个类的单元格。我遇到了像这样的非操作选择器
table :not(thead):not(.cell-class) {
background-color: #FFFFFF;
}
+----------------+---------------+----------+----------+
| | | | | <-- <thead>
+----------------+---------------+----------+----------+
| .cell-class | x | x | x |
+----------------+---------------+----------+----------+
| .cell-class | x | x | x |
+----------------+---------------+----------+----------+
| .cell-class | .cell-class | x | x |
+----------------+---------------+----------+----------+
应该只选择x标记的单元格。有谁知道如何妥善解决它?
答案 0 :(得分:2)
以下选择器语法应该执行您正在寻找的内容:
thead, td:not(.cell-class){
}
答案 1 :(得分:0)
尝试使用此
tbody td:not(.cell-class) {
background: #ffffff;
}
如果您在tbody
之后没有附加tr
- 元素,那么它甚至应该可以使用thead
。 (至少在使用此fiddle测试的chrome中进行测试。)