html - 字体在 chrome/firefox 中显示不同

标签 html css fonts cross-browser

每一个。

我在不同浏览器中显示我的页面时遇到问题。这里我使用的是“Myrid Set Pro”字体。

我在 chrome 中得到了正确的结果。但不是在火狐中。我附上了这些文件。

Part of Website in Chrome Look Like this

Part Of Website in Firefox Look Like this

这里第一个是在 Chrome 中预览。 第二个是在 Firefox 中预览。

我也试过文本渲染。但是没用

text-rendering: optimizelegibility;

最佳答案

目前,关于这个话题还没有达成共识。可耻的是,有很多技巧,但没有针对此问题的具体解决方案。

问题是,每个浏览器和操作系统处理字体呈现的方式不同。这就是为什么很难跨 Web 浏览器和系统获得相同结果的原因。

同样的问题在 SO 上被问过几次:

1.- How do I get font to display properly in all browsers?

2.- Same font yet its weight seems different on different browsers

下面,我将列出一些建议的解决方案;但是它们可能不起作用:

// @Mohamed Anis Dahmani
html, html a {
    -webkit-font-smoothing: antialiased;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
}

// @oneiota
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;

还有一个使用 translate3d 的:webfont-rendering-fix.css

body {
  -webkit-transform: translate3d(0px, 0px, 0px);  /* Force hardware acceleration to fix safari opacity bugg*/ 
}

我的建议是寻找网络安全字体 http://cssfontstack.com/这将最大限度地减少跨网络浏览器和操作系统的字体呈现的影响。

关于html - 字体在 chrome/firefox 中显示不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26352852/

相关文章:

javascript - JS - 检测触摸设备不起作用 API 3

html - 我怎样才能使这个响应式布局居中?

php - 在 Woocommerce 中添加除特定国家/地区以外的内联 CSS

c# - "É"未正确转换为两个字节

android - TextView 字体大小不符合设备字体大小设置

html - iOS 版 Chrome 和 Safari 上的背景图片

javascript - 将 iframe src 从一个 html 页面传递到另一个

javascript - 使用 css 自定义按钮

html - 选择哪个重叠的 div 在上面

javascript - react-native 链接给出错误 no such file or directory info.plist