CSS@font-face不工作
我第一次尝试使用@font-face,但它不起作用。有人能帮我解决这个问题吗 为什么这个脚本不起作用CSS@font-face不工作,css,Css,我第一次尝试使用@font-face,但它不起作用。有人能帮我解决这个问题吗 为什么这个脚本不起作用 <style> @font-face{ font-family: myfont; src: url('entypo.eot'); src: url('entypo.eot?iefix') format('eot'), url('entypo.woff') format('woff'),
<style>
@font-face{
font-family: myfont;
src: url('entypo.eot');
src: url('entypo.eot?iefix') format('eot'),
url('entypo.woff') format('woff'),
url('entypo.ttf') format('truetype'),
url('entypo.svg#helvetica') format('svg');
font-weight: normal;
font-style: normal;
}
div {
font-family: myfont;
}
</style>
</head>
<body>
<div>
sdfdfdsfsdf
</div>
@字体{
字体系列:myfont;
src:url('entypo.eot');
src:url('entypo.eot?iefix')格式('eot'),
url('entypo.woff')格式('woff'),
url('entypo.ttf')格式('truetype'),
url('entypo.svg#helvetica')格式('svg');
字体大小:正常;
字体风格:普通;
}
div{
字体系列:myfont;
}
SDFDSFSDF
试试这个
@font-face
{
font-family: 'SegoeUI';
src: url('Fonts/segoeui.eot');
src: url('Fonts/segoeui.eot?#iefix') format('embedded-opentype'), url('fonts/segoeui.ttf') format('truetype');
}
@font-face
{
font-family: 'SegoeLight';
src: url('Fonts/segoeuil.eot');
src: url('Fonts/segoeuil.eot?#iefix') format('embedded-opentype'), url('fonts/segoeuil.ttf') format('truetype');
}
我认为你的字体不是英文字体,对吗?无论如何我经常遇到这个问题,因为我使用波斯语字体,有时它们不起作用!我所做的是用不同的软件,如在线字体转换器,将它们重新转换成不同的字体格式。有时候我的字体可以在IE、Firefox中使用,但不能在chrome中使用!然后我重新转换它们,一切都变正常了!因此,重新转换它们可能会解决您的问题。 PS:一些做这种事情的酷网站:
将
'
添加到myfont,并将helvetica
更改为myfont
,如下所示:
@font-face{
font-family: 'myfont';
src: url('entypo.eot');
src: url('entypo.eot?iefix') format('eot'),
url('entypo.woff') format('woff'),
url('entypo.ttf') format('truetype'),
url('entypo.svg#myfont') format('svg');
font-weight: normal;
font-style: normal;
}
div {
font-family: 'myfont';
}
您的字体应该与CSS相关,如果它位于单独的文件夹中,请使用相关路径 比如说
// Directory Structure
images
css
fonts
-index.html
如果您的字体位于某个文件夹中,而CSS位于其他文件夹中,请使用以下CSS
@font-face{
font-family: 'myfont';
src: url('../fonts/entypo.eot');
src: url('../fonts/entypo.eot?iefix') format('eot'),
url('../fonts/entypo.woff') format('woff'),
url('../fonts/entypo.ttf') format('truetype'),
url('../fonts/entypo.svg#myfont') format('svg');
font-weight: normal;
font-style: normal;
}
字体来自哪里?你是如何制作不同的格式的?你确定你上传了这些文件吗?哪里您在哪些浏览器上进行了测试?“不工作”是什么意思?是的,它不是英文字体。这是一个免费的图标字体,我从web@shinosn所以我想我的答案是你的