css - Firefox 忽略 CSS font-weight 属性

标签 css google-chrome firefox fonts font-face

不确定我是否使用了正确的过程来显示具有 3 个权重的字体——“正常”、“粗体”和“更轻”——但是,它似乎在大多数浏览器中都有效,除了 Firefox。

Firefox 似乎在使用 `font-weight: light`;作为默认?

字体在 Chrome 中的显示方式正是我所追求的。

@font-face {
    font-family: 'lovelo';
    src: url('../fonts/lovelo.eot');
    src: url('../fonts/lovelo.eot?#iefix') format('embedded-opentype'),
         url('../fonts/lovelo.woff') format('woff'),
         url('../fonts/lovelo.ttf') format('truetype'),
         url('../fonts/lovelo.svg#loveloblack') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'lovelo';
    src: url('../fonts/lovelo-bold.eot');
    src: url('../fonts/lovelo-bold.eot?#iefix') format('embedded-opentype'),
         url('../fonts/lovelo-bold.woff') format('woff'),
         url('../fonts/lovelo-bold.ttf') format('truetype'),
         url('../fonts/lovelo-bold.svg#loveloblack') format('svg');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'lovelo';
    src: url('../fonts/lovelo-light.eot');
    src: url('../fonts/lovelo-light.eot?#iefix') format('embedded-opentype'),
         url('../fonts/lovelo-light.woff') format('woff'),
         url('../fonts/lovelo-light.ttf') format('truetype'),
         url('../fonts/lovelo-light.svg#loveloblack') format('svg');
    font-weight: lighter;
    font-style: normal;
}

working example

最佳答案

您可以尝试使用字体粗细的实际数字。
400 与 font-weight 相同:正常。
700 与 font-weight: 粗体相同。
100、200 或 300 是附加值。您必须选择一种您想要的效果。

关于css - Firefox 忽略 CSS font-weight 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17414815/

相关文章:

css - 背景渐变未在 Safari 和 Firefox 上加载

css - stroke-opacity 对 svg :text while conveting svg to pdf using fop-2. 2 没有影响

android - 我可以将手机用作带有 Windows 10 登录选项的 webauthn 安全 key 吗

java - 使用 BrowserMobProxy、Selenium、Firefox、marionette/gecko 获取请求和响应

windows - 最小化其他应用程序的批处理文件

html - 将 <a> 放在边界上?邮件通讯

javascript - Owl Carousel 幻灯片全部显示为一张幻灯片

javascript - 为什么 Chrome 在 TypeScript 中显示\ufeff 符号和灰线?

google-chrome - 带有CSP img-src的Chrome浏览器*仍会阻止图像

javascript - 如何通过已经建立的Websocket连接发送Websocket消息?