【问题标题】:For bold to 700 for normal to 400 when minify css缩小css时,粗体为700,正常为400
【发布时间】:2012-11-15 11:56:18
【问题描述】:

当我使用在线 css 工具(例如 https://csscompressor.net/)缩小我的 css 时,工具将 font-weight:bold 转换为 font-weight:700; , font-weight:normal to font-weight:400;为什么?使用 700 或 400 以获得高性能?

【问题讨论】:

  • 可能是因为它保存了一个字符?毕竟你用的是压缩机……
  • "粗体" => 4 个字符,"700" => 3 个字符。 “正常” => 6 个字符,“400” => 3 个字符。缩小!

标签: css performance minify


【解决方案1】:

在 css 中,font-weight 属性是从 100 到 900 的 9 点数字刻度。

为方便起见,定义了特殊名称 normalbold,并赋予值 400 和 700。

(其他文本值inheritbolderlighter根据父元素的权重计算为“与父元素相同”、“列表中的下一个较高值100, 400, 700, 900”和“下一个较低值来自列表100, 400, 700, 900")

欲了解更多详情,请参阅http://www.w3.org/TR/CSS21/fonts.html#font-boldness

(所以,当你写 font-weight:bold 时,你的意思是 font-weight:700,正如 cmets 指出的那样,后者短一个字符,因此更“最小”......)

【讨论】:

    猜你喜欢
    • 2013-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-13
    • 1970-01-01
    • 1970-01-01
    • 2012-02-23
    • 1970-01-01
    相关资源
    最近更新 更多