@ font-face不工作 [英] @font-face not working
问题描述
不知道为什么但字体不显示。请帮助。
CSS(在css文件夹中):
style.css:
@ font-face {
font-family:Gotham;
src:url(../ fonts / gothammedium.eot);
src:local('Gotham-Medium'),
url(../ fonts / Gotham-Medium.ttf)format('truetype');
}
a {
font-family:Gotham,Verdana,Arial;
}
意味着你上去一个文件夹,然后找到斜杠后面的文件夹。
例如:
如果您的index.html位于文件夹 html / files
是在 html / fonts
,..是好的(因为你必须回去一个文件夹去 / fonts
)。是你的index.html在 html
和你的字体在 html / fonts
,那么你应该只使用一个句点。 / p>
另一个问题可能是您的浏览器可能不支持.eot字体文件。
编辑:忘记了.eot的部分,我错过了一个代码(也许是指向您的网站的实时版本的链接)
请尝试以下操作:
@ font-face {
font-family:Gotham;
src:url(../ fonts / gothammedium.eot);
src:url(../ fonts / Gotham-Medium.ttf);
}
Don't know why but font is not displaying.Please help.
CSS(in css folder): style.css:
@font-face {
font-family: Gotham;
src: url(../fonts/gothammedium.eot);
src: local('Gotham-Medium'),
url(../fonts/Gotham-Medium.ttf) format('truetype');
}
a {
font-family:Gotham,Verdana,Arial;
}
Double period (..) means you go up one folder and then look for the folder behind the slash. For example:
If your index.html is in the folder html/files
and the fonts are in html/fonts
, the .. is fine (because you have to go back one folder to go to /fonts
). Is your index.html in html
and your fonts in html/fonts
, then you should use only one period.
Another problem could be that your browser might not support .eot font-files.
Without seeing more of your code (and maybe a link to a live version of your website), I can't really help you further.
Edit: Forget the .eot part, I missed the .ttf file in your css.
Try the following:
@font-face {
font-family: Gotham;
src: url(../fonts/gothammedium.eot);
src: url(../fonts/Gotham-Medium.ttf);
}
这篇关于@ font-face不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!