この例で最初のルールが 2 番目ではなく採用される理由を説明してもらえますか? 私の CSS の特異性の知識によると、2 番目はより具体的であり、使用する必要があります。ただし、すべてのブラウザが最初に使用します。
例:
CSS:
table.data .negative {
/* css specificity: 0,0,2,1 */
color: red;
}
table.data tr.inactive td {
/* css specificity: 0,0,2,3 */
color: gray; /* this should be used */
}
HTML:
<table class="data">
<tr class="inactive">
<td><span class="negative">should be gray</span></td>
</tr>
</table>