html - @font-face 未在任何浏览器中加载

标签 html css web font-face

我是@font-face 的菜鸟。我浏览了这里的所有帖子和几个教程,但我无法弄清楚为什么我的字体没有加载。我正在激活和停用字体以查看它是否通过服务器加载而没有运气。奇怪的是当它被激活时,它在浏览器中工作但在本地不工作。

我在 fonts 文件夹中有 css 文件并全部上传到服务器。我已经测试了字体附带的演示文件并且工作正常。

我确定我错过了一些非常基本的东西,我会觉得自己很愚蠢。

这是我的@font-face CSS:

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

这是我试图让它运行的页面: http://takatech.com/index.2.html#

非常感谢任何帮助。

最佳答案

这是因为字体系列是 capsuularegular 而你在#main-wide Capsuula

因此,将您的 CSS 更改为:

#main-wide {
    color: #999999;
    font-family: "capsuularegular";
    font-size: 14px;
    line-height: 30px;
    text-align: left;
}

关于html - @font-face 未在任何浏览器中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21484029/

相关文章:

file - HTTP 路径必须以斜杠开头吗?

css - 如何用 Div 替换我的 'Section' 和 'Article' 标签?

javascript - 在中文网络上测试网站

html - 将 float 的 div 从上到下对齐

html - 从普通更改为粗体时,CSS 相同的文本自动换行

css - 将 div 放在视口(viewport)底部而不覆盖以前的内容

html - 在网络上使用特殊字符符号时应该注意什么?

html - 滚动条调整页面大小

javascript - 将 Canvas 保存为 PNG 或 JPEG 文件

javascript - zoom : browser renders a space gap between containers while zooming, 上有趣的 Css 渲染问题出现在每个浏览器中,但不会出现在 Firefox 中