html - CSS 覆盖 'font-weight' 属性

标签 html css fonts

我遇到了一个奇怪的问题,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/

相关文章:

html - 使内容在固定 div 之间负责

html - 父级下拉菜单按钮未导航到 href 位置

javascript - 带有 JS 的自适应菜单

html - NodeJS Express HTML 隐藏输入值仅显示第一个单词

html - 带有 div 和 css 的响应图像(无 img 标签)

html - 结合 :nth-child with :not() selectors

jquery - 如何垂直翻转进度条?

css - ASPNETCDN Bootstrap Graphicons 不工作

java - 在 Android 应用程序上显示印地语字符

html - 谷歌字体不会加载 html