@font无法使用fontsquirrel

Mer*_*rix -1 css html5 font-face

我正在尝试使用这种字体:http://www.fontsquirrel.com/fontfacedemo/eb-garamond 所以我下载了类型套件并将其放在正确的目录中.

CSS:

@font-face {

font-family: 'EBGaramondSC';
src: url('/EBGaramondSC-webfont.eot');
src: url('/EBGaramondSC-webfont.eot?#iefix') format('embedded-opentype'),
     url('/EBGaramondSC-webfont.woff') format('woff'),
     url('/EBGaramondSC-webfont.ttf') format('truetype'),
     url('/EBGaramondSC-webfont.svg#EBGaramondRegular') format('svg');
font-weight: normal;
font-style: normal;
}

p.style2 {font: 18px/27px 'EBGaramondSC', Arial, sans-serif;}
Run Code Online (Sandbox Code Playgroud)

[p class="style2"] Alfab Solutions, LLC is a custom security firm who focuses on rural secruity solutions. We offer rugged, secure camera systems which integrate into our SSL encrypted website. We provide 24/7 access to your security footage, so you can have peace of mind that your assets are safe. [/p] Ignore brackets

@font-face {

font-family: 'EBGaramondSC';
src: url('/EBGaramondSC-webfont.eot');
src: url('/EBGaramondSC-webfont.eot?#iefix') format('embedded-opentype'),
     url('/EBGaramondSC-webfont.woff') format('woff'),
     url('/EBGaramondSC-webfont.ttf') format('truetype'),
     url('/EBGaramondSC-webfont.svg#EBGaramondRegular') format('svg');
font-weight: normal;
font-style: normal;
}

p.style2 {font: 18px/27px 'EBGaramondSC', Arial, sans-serif;}
Run Code Online (Sandbox Code Playgroud)

Firebug甚至没有显示正确的字体图像.是什么赋予了?
我有一个奇怪的目录结构.索引是.php,它是从模板文件生成的.所以我的字体应该在模板目录中,因为它们只影响那里的html.

小智 6

如果你看一下CSS代码,你会发现url都是绝对路径(你知道相对路径和绝对路径吗?如果没有,请阅读它们:D)

@font-face {
   src: url('/EBGaramondSC-webfont.eot');
}
Run Code Online (Sandbox Code Playgroud)

请注意/

它应该是:

src: url('/templates/EBGaramondSC-webfont.eot');
Run Code Online (Sandbox Code Playgroud)

或者,如果字体文件与CSS位于同一文件夹中:

src: url('EBGaramondSC-webfont.eot');
Run Code Online (Sandbox Code Playgroud)

打开Chrome Inspector(输出404警告)告诉我:

无法加载资源:服务器响应状态为404(未找到)http://www.alfabsolutions.com/EBGaramondSC-webfont.svg

所以是的,那个!祝好运.