0

我对CSS 特异性的理解是tr.makeitred应该推翻.makeitblue.

那么我错过了什么,这意味着在这种情况下Blue仍然是蓝色的.makeitblue... 而不是被更高的特异性覆盖tr.makeitred

(即使添加!important使其color:red !important不做任何事情)

tr.makeitred {
  color:red;
}
.makeitblue {
  color:blue;
}
<table>
  <tbody>
    <tr class="makeitred">
      <td>Red</td>
      <td class="makeitblue">Blue</td>
    </tr>
  </tbody>
</table>

4

0 回答 0