Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 无法将@font-face与字体松鼠转换一起使用_Css - Fatal编程技术网

Css 无法将@font-face与字体松鼠转换一起使用

Css 无法将@font-face与字体松鼠转换一起使用,css,Css,我一直在尝试在我的网页上添加我自己的字体,但我仍然不知道如何使用字体Squirrel conversor。我下载了一个免费的.ttf字体,并用生成器对其进行了如下转换: @font-face { font-family: 'AbiteRegular'; src: url('fonts/abite-webfont.eot'); src: url('fonts/abite-webfont.eot?#iefix') format('embedded-opentype'), url('fon

我一直在尝试在我的网页上添加我自己的字体,但我仍然不知道如何使用字体Squirrel conversor。我下载了一个免费的.ttf字体,并用生成器对其进行了如下转换:

@font-face 
{
font-family: 'AbiteRegular';
src: url('fonts/abite-webfont.eot');
src: url('fonts/abite-webfont.eot?#iefix') format('embedded-opentype'),
     url('fonts/abite-webfont.woff') format('woff'),
     url('fonts/abite-webfont.ttf') format('truetype'),
     url('fonts/abite-webfont.svg#AbiteRegular') format('svg');
font-weight: normal;
font-style: normal;
}
body 
{
font-family: 'AbiteRegular';
}
Where fonts是转换.ttf文件的文件夹。我是这样用的:

@font-face 
{
font-family: 'AbiteRegular';
src: url('fonts/abite-webfont.eot');
src: url('fonts/abite-webfont.eot?#iefix') format('embedded-opentype'),
     url('fonts/abite-webfont.woff') format('woff'),
     url('fonts/abite-webfont.ttf') format('truetype'),
     url('fonts/abite-webfont.svg#AbiteRegular') format('svg');
font-weight: normal;
font-style: normal;
}
body 
{
font-family: 'AbiteRegular';
}
所有这些配置都在.css文件中。
但正文忽略了这一点。你知道为什么会这样吗?

你的字体
URL

url('fonts/abite-webfont.eot');...

或者您正在使用的浏览器不支持动态字体。

是否已在其他浏览器中签入?登录IE、Firefox、Chrome。如果甚至没有一个浏览器显示字体,那么您的文件夹结构可能是错误的

你的文件夹结构是这样的吗?包含
@font-face
声明(比如
font.css
)的css文件的放置方式应确保旁边有一个名为
font
的文件夹,字体文件应位于该文件夹内

/font.css
/fonts/abite-webfont.eot
/fonts/abite-webfont.woff
/fonts/abite-webfont.ttf
/fonts/abite-webfont.svg
这应该适用于所有浏览器,包括IE6、IE7和IE8。只要确保路径正确即可。而且,
body
声明应该在
font.css
声明之后,也就是说,
font.css
应该放在任何样式之前

希望这有帮助!:)