html - CSS 字体粗细数字 : how do they work?

标签 html css fonts

我正在尝试使用 font-weight 来调整字体的粗体程度。据我了解,值 500 是正常字体粗细,值 700 是粗体的默认字体粗细。

但是,当我输入 599 时,它根本没有改变 font-weight。但是当我输入 600 时,它会跳到默认的粗体字重。值 600-900 的结果相同。然后,当您超过 900 时,字体粗细会恢复为正常字体粗细。为什么会这样?

#fontStyle {
    border: 1px solid black;
    font-weight: 599;
}
<div id="fontStyle"> fontStyle </div>

最佳答案

涵盖了如何将数值映射到字体粗细的详细信息in the spec其中指出:

The values '100' to '900' form an ordered sequence, where each number indicates a weight that is at least as dark as its predecessor. The keyword 'normal' is synonymous with '400', and 'bold' is synonymous with '700'. Keywords other than 'normal' and 'bold' have been shown to be often confused with font names and a numerical scale was therefore chosen for the 9-value list.

'599' 不是 font-weight 属性的有效值

关于html - CSS 字体粗细数字 : how do they work?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35471486/

相关文章:

jquery - 如何防止字体在我的 wordpress 网站中加载两次?

javascript - 如何使用Javascript向html页面添加/删除CSS/颜色样式?

html - 视口(viewport)与百分比

macos - svgexport 在 Mac OS X (10.10.3) 上正确渲染字体,但在 Ubuntu 14.04 上不正确

html - 如何设置类型为 ="button"的输入的样式?

css - 如何垂直对齐 div 与 div 内的背景颜色以便背景填满?

math - 在graphviz中使用符号字体/数学符号

javascript - 如何使用动画颜色变化突出显示搜索词

html - 使用用户选择 : none 的 mousedown+mousemove 性能糟糕

javascript - 水平对齐表格形式的元素