【发布时间】:2016-03-30 04:58:38
【问题描述】:
有人能解释一下吗?
HTML:
<table>
<tr>
<td></td>
<td class="size20">
<div>Div 1 is font-size: 20px</div>
<table>
<tr>
<td>
<div>Div 2 should be font-size 20px because of inheritance and specificity</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
CSS:
.size20 {
font-size: 20px;
}
td {
font-size: 10px;
}
【问题讨论】:
-
有什么问题,你想要什么?
-
在 css 中,最后一个类的效果会被之前的重叠。它正确地继承了 size20 类,但是当它到达 td 时,它与 sclass size20 重叠 td 类
-
问题是他不明白为什么代码会这样。那就是问题所在。他想了解。这就是他想要的。从单行字中可以看出,“任何人都可以对此有所了解吗?”
标签: css html-table font-size css-specificity