无法使字体正常工作
我正在尝试使用@font-face
,但我并不是很成功。 到目前为止,我一直在使用 Google 字体:
// HTML header
<link href='http://fonts.googleapis.com/css?family=Cuprum' rel='stylesheet' type='text/css'>
//CSS
#leftSection nav {
font-family: "Cuprum", Verdana, Arial, sans-serif;
}
然后我下载了字体并尝试使用 font-face
:
这是我的 CSS:
@font-face {
font-family: 'Cuprum';
font-weight: normal;
font-style: normal;
font-size: 0.5em;
src: url('cuprum.eot?') format('eot'),
url('cuprum.woff') format('woff'),
url('cuprum.ttf') format('truetype'),
url('cuprum.svg#Cuprum') format('svg');
}
#leftSection nav {
font-family: "Cuprum", Verdana, Arial, sans-serif;
}
字体与 CSS 位于同一文件夹中。
我已经查看并测试了其他解决方案,但仍然无法使其正常工作。
我正在使用以下浏览器进行测试:FF7、IE8
更新
我添加了 font-size: 0.5em;
这至少应该改变字体大小。但这也没有发生。所以我猜测整个 @font-face
被忽略了。
I'm trying to use @font-face
, but I'm not being very successfull.
Up till now, I've been using Google fonts:
// HTML header
<link href='http://fonts.googleapis.com/css?family=Cuprum' rel='stylesheet' type='text/css'>
//CSS
#leftSection nav {
font-family: "Cuprum", Verdana, Arial, sans-serif;
}
Then I downloaded the fonts and tried using font-face
:
This is my CSS:
@font-face {
font-family: 'Cuprum';
font-weight: normal;
font-style: normal;
font-size: 0.5em;
src: url('cuprum.eot?') format('eot'),
url('cuprum.woff') format('woff'),
url('cuprum.ttf') format('truetype'),
url('cuprum.svg#Cuprum') format('svg');
}
#leftSection nav {
font-family: "Cuprum", Verdana, Arial, sans-serif;
}
The fonts are located in the same folder as the CSS.
I've looked at, and tested oteher solutions, but I'm still not able to get it wokring.
I'm testing with the following browsers: FF7, IE8
Update
I've added font-size: 0.5em;
This should at least change the font size. But that's not happening either. So I'm guessing the entire @font-face
is ignored.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您尝试过使用 Font Squirrel 生成器吗?只需上传字体,它就会为您完成一切,非常简单。
这是链接:
http://www.fontsquirrel.com/fontface/generator
Did you try using the Font Squirrel generator? Just upload the font and it will do everything for you, it's real simple.
Here is the link:
http://www.fontsquirrel.com/fontface/generator
嘿史蒂文你搞定了吗?
你为什么不试试这个呢。
将其插入到你的CSS中:
我希望它能起作用。 :)
Hey Steven are you done with this?
Why dont you try this out.
insert this inside your css:
i hope it will work. :)
我认为您可以尝试不使用
"Cuprum"
周围的引号。此外,如果您/用户在本地安装了该字体,有时也会出现问题。
为了解决这个问题,您可以设置一个假的
本地
引用。请参阅 Paul Irish 的 Bulletproof @font-face 语法
编辑< /strong>
您可以尝试的另外两件事:
将字体名称更改为小写,
cuprum
。从声明中删除以下内容:
I think you could try it without the quotes around
"Cuprum"
.Also, there is sometime an issue if you/the user have that font installed locally.
To get around that, you can set a fake
local
reference.See Paul Irish's Bulletproof @font-face syntax
EDIT
Two other things you might try:
change the font name to lowercase,
cuprum
.Remove the following from the declaration: