Html 所有Css选择器<;td>;特定的<;th>;
我有多张这样的桌子 表1Html 所有Css选择器<;td>;特定的<;th>;,html,css,Html,Css,我有多张这样的桌子 表1 一个 两个 三 日期时间 价格 数 日期时间 价格 数 如果您希望以相同的方式对和相应的进行样式设置,则最好给它们赋予相同的类 <!-- set classes for all tr --> <p> A class for spesial col</p> <table border="1" style="border-collapse: collapse" class="ev
一个
两个
三
日期时间
价格
数
日期时间
价格
数
如果您希望以相同的方式对
和相应的
进行样式设置,则最好给它们赋予相同的类
<!-- set classes for all tr -->
<p> A class for spesial col</p>
<table border="1" style="border-collapse: collapse" class="every-other-one">
<thead>
<tr>
<th class="Two">Two</th>
<th class="Three">Three</th>
<th class="One">One</th>
<th class="Four">Four</th>
</tr>
</thead>
<tbody>
<tr>
<td class="Two">Price</td>
<td class="Three">Number</td>
<td class="One">DateTime</td>
<td class="Four">Text</td>
</tr>
<tr>
<td class="Two">Price</td>
<td class="Three">Number</td>
<td class="One">DateTime</td>
<td class="Four">Text</td>
</tr>
<tr>
<td class="Two">Price</td>
<td class="Three">Number</td>
<td class="One">DateTime</td>
<td class="Four">Text</td>
</tr>
</tbody>
</table>
<br>
一门专门的课程
两个
三
一个
四
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
它应该是这样的我们可以将class设置为th,然后像这样选择
th.redCallas td {
backGround-color:#a33;
color: #f
}
tr.redClass td{
背景色:#a33;
颜色:#fff;
}
雷德科尔博士{
背景色:#a33;
颜色:#fff;
}
.每隔一个tr:n个孩子(偶数){背景:#CCC}
tr:n个孩子(奇数){背景:#FFF}
一门专门的课程
两个
三
一个
四
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
一个适合所有学生的班级
两个
三
一个
四
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
每隔一个
两个
三
一个
四
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
给你。
由于您希望以特定列为目标,从示例中的表中,我假设如果您能够以tr
的每个n子(2)
columntd
为目标,您就可以开始了,您的CSS代码应该是这样的
tr.redClass td{
背景色:#a33;
颜色:#fff;
}
雷德科尔博士{
背景色:#a33;
颜色:#fff;
}
。每隔一个tr:n个孩子(n)td:n个孩子(2){背景:#a33}
一门专门的课程
两个
三
一个
四
价格
数
日期时间
正文
价格
数
日期时间
正文
价格
数
日期时间
正文
最简单的方法就是给他们上课。如果它们的顺序相同,则可以使用:n子css伪类。但是,我希望设置特定列的样式,而不是奇偶行。