简体   繁体   English

如何根据CSS属性“ font-weight”计算文本粗细?

[英]How is text thickness calculated according to css property “font-weight”?

Font weight in Firefox: Firefox中的字体粗细:

Firefox中的字体粗细

Font weight in Chrome: Chrome中的字体粗细:

chrome字体粗细

The font-weight value is in the order of 100,500,600,700,900, which is set according to the W3C standard. font-weight值大约为100,500,600,700,900,这是根据W3C标准设置的。

You can clearly see that the text thickness is not changed linearly, and in different browser not exactly the same (it's almost the same from 100 to 500.). 您可以清楚地看到,文本的厚度不是线性变化的,并且在不同的浏览器中也不完全相同(从100到500几乎相同)。 So I wonder, is there a standard on how the text is calculated according to font-weight ? 所以我想知道,是否有关于如何根据font-weight计算文本的标准?

The algorithm, at least in theory, is: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-weight 该算法至少在理论上是: http : //www.w3.org/TR/CSS2/fonts.html#propdef-font-weight

The CSS3 specification is similar - http://www.w3.org/TR/css3-fonts/#font-weight-prop CSS3规范类似-http: //www.w3.org/TR/css3-fonts/#font-weight-prop

As it states, bold faces are often synthesized by user agents for faces that lack actual bold faces. 如其指出的那样,粗体面孔通常由用户代理针对缺乏实际粗体面孔的面孔来合成。

I've found its often better to avoid font-weights all together, and use a specific font face. 我发现通常最好避免一起使用字体粗细,而使用特定的字体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM