html - 如何将 .ttf 和 .eot 文件作为一种字体嵌入?

标签 html css

我的字体无法兼容所有浏览器。 .ttf 文件适用于所有浏览器,explorer 除外。这是我当前的代码:

@font-face {
  font-family: Gotham;
  src: url("../Gotham-Book.eot"),
  src: url("../Gotham-Book.eot#iefix") format('embedded-opentype');
  src: url("../Gotham-Book.ttf") format("truetype");
}

最佳答案

你有太多src:声明,从而用一个新的覆盖 IE hacks。浏览器只能看到 tff在你的例子中。

您应该只有两个,第一个是单独的。请注意带有字体的中间行如何具有 ,而不是 ;最后还有怎么没有src:在最后一个 oe 中。

@font-face {
  font-family: Gotham;
  src: url("../Gotham-Book.eot"),
  src: url("../Gotham-Book.eot#iefix") format('embedded-opentype'),
       url("../Gotham-Book.ttf") format("truetype");
}

关于html - 如何将 .ttf 和 .eot 文件作为一种字体嵌入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54655467/

相关文章:

asp.net - 在 GridView 中交错行/列颜色

javascript - HTML 列表 : How can I count the number elemnts retrieved in the list

javascript - 通过复制粘贴重新创建网页?

javascript - 如何定位下一个 <div> 元素?

在 <div> 容器中显示动态消息的 JavaScript 函数

html - CSS 适用于所有内部 div 但跳过第一个 child

CSS 重复值检查器?

html - 如何将 ng-style 与 div :after? 一起使用

javascript - 如何使用 JavaScript 用两根手指旋转整个 Canvas ?

html - TD 内的动画打破表格边框 : weird chrome bug?