我遇到了一个奇怪的问题,CSS 覆盖了“font-weight”属性。下面给出的是显示问题的代码:-
元素'p'的'font-weight'设置为小(以同样的方式将颜色设置为紫色)。但是字体在 FF/Chrome 上仍然呈现为粗体,而颜色覆盖为紫色。
知道为什么会这样吗?
p {
font-weight: small;
color: purple;
}
#speciality_test {
font-weight: bold;
color: red;
}
.class_speciality_test {
font-weight: bold;
color: red;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="speciality_test">
<p>
Inside identifier... HTML CSS test pages.
</p>
</div>
<div class="class_speciality_test">
<p>
Inside class... HTML CSS test pages.
</p>
</div>
</body>
</html>
最佳答案
没有font-weight:small;
。我想你的意思是 font-weight:normal;
或 font-size:small;
。
另见 CSS Fonts Module Level 3: 3.2 Font weight: the font-weight property .
关于html - CSS 覆盖 'font-weight' 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9293531/