html - 在不同浏览器中使用 WordPress 字体

标签 html css wordpress browser google-font-api

因此,我了解到 Windows 版 Chrome 存在一个错误,会导致渲染效果不佳。 Opera 也是这样吗?为什么它不适用于 IE?

字体:http://www.google.com/fonts#UsePlace:use/Collection:Libre+Baskerville

嵌入:

wp_enqueue_style('fontbask', 'http://fonts.googleapis.com/css?family=Libre+Baskerville:400,500,700,400italic&subset=latin,latin-ext');

我尝试过的CSS

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-stroke: 1px transparent;

结果:

enter image description here

浏览器版本:

歌剧19.0.1326.63 Chrome 32.0.1700.107 m 互联网浏览器 11.0.9600.16518 火狐26.0

我还尝试使用 font-face 来包含字体,结果完全相同。

@font-face {
    font-family: 'LibreBaskerville';
    src: url('fonts/LibreBaskerville-Regular.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

我下载了字体@ http://www.fontsquirrel.com/fonts/libre-baskerville?q[term]=baskerville&q[search_check]=Y 在此屏幕截图中,它看起来并没有那么糟糕,但您可以在这里看到实时内容:http://www.citizen-science.at/wordpress/

我还发现了来自 http://www.google.com/fonts#UsePlace:use/Collection:Libre+Baskerville 的字体渲染得也很糟糕。所以看来是浏览器问题。

当我使用本地字体而不是 Google 字体时,IE 能够显示它,但 Opera 和 Chrome 仍然无法显示

最佳答案

Opera 在字体渲染方面存在问题。 this将帮助您找到解决方案。如果您不必使用 Google 字体,那么我推荐 this用于生成网络字体的网站。这在跨浏览器兼容性方面表现出色。

@font-face {
    font-family: 'libre_baskervilleregular';
    src: url('librebaskerville-webfont.eot');
    src: url('librebaskerville-webfont.eot?#iefix') format('embedded-opentype'),
         url('librebaskerville-webfont.woff') format('woff'),
         url('librebaskerville-webfont.ttf') format('truetype'),
         url('librebaskerville-webfont.svg#libre_baskervilleregular') format('svg');
    font-weight: normal;
    font-style: normal;

}

fontsquirrel 生成的网络字体。使用这个,这些将与包括 Opera 在内的跨浏览器兼容性一起工作。

祝你好运!

关于html - 在不同浏览器中使用 WordPress 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21802399/

相关文章:

html - 在几个 div 周围设置边框

wordpress - 如何在自定义帖子类型永久链接中添加自定义分类法?

php - Woocommerce 订阅 - 开始日期

javascript - 替换 div 内的文本

javascript - HTML5/Javascript 图像加载方法 & 传递给变量

html - 如何在图像上放置跨度

javascript - jQuery:滚动时平滑的动画字体大小变化

html - 向左浮动导致我的输入标签在顶部而不是 v-align middle

javascript - 在 var 函数中覆盖 jQuery 添加的内联样式

php - wordpress coinslider 不工作