【发布时间】:2013-07-14 14:47:08
【问题描述】:
我正在尝试使用 Entyo 字体,但无法正常工作。我将整个网站更改为字体,并且在加载页面时可以注意到明显的暂停,搜索但可能找不到字体?
我的 CSS:
@font-face {
font-family: 'EntypoRegular';
src: url('fonts/entypo-webfont.eot');
src: url('fonts/entypo-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/entypo-webfont.woff') format('woff'),
url('fonts/entypo-webfont.ttf') format('truetype'),
url('fonts/entypo-webfont.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
字体文件夹在根目录中。
谢谢
编辑:
文件夹结构:
Main
-> fonts
-> -> entypo.eot
-> -> entypo.svg
-> -> entypo.ttf
-> -> entypowoff
-> CSS
-> -> stylesheet with @fontface call
-> includes
-> Etc etc
将 url 更新为 //fonts/entypo.eot 等等。字体正在加载并在 Web 开发检查器中可见,但仍不显示在屏幕上。仅在 safari 和 chrome 中测试,两者结果相同
编辑:CSS 细节。
@charset "UTF-8";
@font-face {
font-family: 'EntypoRegular';
src: url('//fonts/entypo-webfont.eot');
src: url('//fonts/entypo-webfont.eot?#iefix') format('embedded-opentype'),
url('//fonts/entypo-webfont.woff') format('woff'),
url('//fonts/entypo-webfont.ttf') format('truetype'),
url('//fonts/entypo-webfont.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
html { -webkit-font-smoothing: antialiased; } /*global improvement on all fonts*/
body {
font-family: "EntypoRegular", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size-adjust:inherit;
}
我删除了所有不必要的内容
【问题讨论】:
-
外部样式表还是页面本身中的上述css?如果在页面中,该页面相对于根在哪里?
-
查看浏览器元素检查器的“net”选项卡,看看是不是字体请求需要这么长时间
-
@PeteScott 外部样式表,但所有其他样式都在应用并且可以正常工作。
-
好的。请记住,字体文件的路径将与此样式表相关。如果此样式表位于站点的根目录中,则您的路径很好。否则他们不是。如果您可以向我们提供您的目录结构的概述,我们可以更具体一些(并且更确定这是否也是问题所在)
-
@PeteScott -.- 业余爱好者。更改了字体的路径。不再收到 404 错误,我可以在网络检查器中看到字体。但实际上仍然没有显示。