html - @font-face 不适用于 Chrome 和 Safari

标签 html css font-face

我使用了@font-face 并以.ttf、.eot 和.woff 格式上传了所有字体。 它在 Firefox 上运行良好,但 Chrome 和 Safari 所有文本都转向 Times New Roman。 这是代码:

@font-face {
font-family: 'Open Sans Regular';
src: url(../open_sans/OpenSans-Regular.eot);
src: url("../open_sans/OpenSans-Regular.woff") format('woff');
src: local('Open Sans'), url('../open_sans/OpenSans-regular.ttf') format('truetype');
}

最佳答案

你有一个非常酷的网站,名为:http://www.fontsquirrel.com/tools/webfont-generator 另外,也修改了您的代码。

@font-face {
font-family: 'open_sansregular';
src: url('../open_sans/OpenSans-Regular.eot');
src: url('../open_sans/OpenSans-Regular.eot?#iefix') format('embedded-opentype'),
     url('../open_sans/OpenSans-Regular.woff') format('woff'),
     url('../open_sans/OpenSans-Regular.ttf') format('truetype'),
     url('../open_sans/OpenSans-Regular.svg#open_sansregular') format('svg');
font-weight: normal;
font-style: normal;

}

PS: open sans 显然是google font 如果是的话那么用google code 嵌入很容易,太靠谱了。网址:http://www.google.com/fonts#UsePlace:use/Collection:Open+Sans 如果仍然发现问题,请告诉我。

关于html - @font-face 不适用于 Chrome 和 Safari,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21629001/

相关文章:

html - w3css - 下拉菜单固定在顶部 (w3-top)

javascript - 页面加载时显示图像

css - 向上移动 div 以填充 Bootstrap 3 布局中的空白空间

html - IE 8 CSS 问题

c# - 在 ASP.NET 中,如何只为 TTF 文件添加 CORS header ?

html - 如何获取 Segoe UI Semilight 字体的 .woff 和 .ttf 文件?

html - 滚动时灰度滤镜与导航栏重叠的图像

javascript - 背景图像更换间隔Javascript

html - Angular 变化显示值

javascript - 以暂停方式在循环中单独设置动画 Div