css - 字体在 Firefox 和 IE 上看起来与在 Chrome 上不同

标签 css google-chrome firefox fonts

我正在使用通过 @font-face 加载的三种字体,它们在 Chrome 上看起来都应该是这样,但在 Firefox 和 IE 上它们看起来不同。就像添加了额外的粗体一样,它们更加 block 状。

@font-face {
    font-family: 'OpenSans-Regular';
    src: url('../fonts/OpenSans-Regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Montserrat-Regular';
    src: url('../fonts/montserrat-regular-webfont.woff2') format('woff2'),
         url('../fonts/montserrat-regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Roboto-Regular';
    src: url('../fonts/roboto-regular-webfont.woff2') format('woff2'),
         url('../fonts/roboto-regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

我如何将这些字体应用于元素:

...
font-family: "OpenSans-Regular", sans-serif;
...

enter image description here

如果我使用开发工具在 Firefox 中编辑该元素并设置 font-family: Open Sans 然后它会正常工作。

这个问题让我很头疼,因为我不明白为什么会这样。

最佳答案

所有应用程序都是用特定的代码块开发的。这就像 HTML 和 CSS 上的“默认字体”。它发生在所有在不同浏览器上打开的网页上。试试这个东西 Facebook 你会看到 Chrome 和 Firefox 上字体的区别。如果字体看起来比你想要的更粗,只需在 CSS StyleSheet 上使用“font-weight”。例如:

body.font-weight: xx px;

关于css - 字体在 Firefox 和 IE 上看起来与在 Chrome 上不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44077863/

相关文章:

javascript - 切换时更改填充

javascript - 如何使用 JavaScript 删除加载 View 中的所有 Chrome 通知?

javascript - 在 Firefox 插件中使用 Iframe

debugging - 分析 SO 中 Firefox 插件的 CPU 消耗

javascript - 从内容脚本更新注入(inject)的 iframe

google-chrome - RSS 和 Atom 内容类型

html - 居中导航栏并添加顶部/底部边框

javascript - 用户发送更新浏览器后是否可以打开 URL?

css - 缓存 svg 文件。使用 img 标签或 svg 标签?

javascript - Chrome 扩展 - 打开多个选项卡