如果我有这个html
<table class="actList">
<tr>
<th> a </th> <th> a </th>
</tr>
<tr>
<td> a </td> <td> a </td>
</tr>
</table>
和这个CSS
.actList {
background-color: rgb(235, 239, 249);
width: 100%;
}
th.activity, th.actList {
text-align: left;
font-weight: normal;
padding: 0.4em 1em 0.4em 0.3em;
}
那么我希望最后一行的意思是,所有 <th>
在表中有 class="actList"
会得到这种风格。但它并不像这里看到的那样
http://jsfiddle.net/littlesandra88/k3Bv5/
th.actList
的正确 CSS 是什么?看起来像?
可以不给每个<th>
加一个class吗? ?
最佳答案
th.actList 表示具有 actList 类的任何第 th 个元素。
在您的示例中,只有表格元素具有此类。类不继承!
我怀疑你在找什么
.actlist th {...}
fiddle 更新:http://jsfiddle.net/k3Bv5/3/
关于html - 为什么这种风格不继承呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6491569/