-1

我正在尝试使用这种字体: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;}

HTML [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

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

4

3 回答 3

6

如果您查看 CSS 代码,您会注意到 url 都是绝对路径(您知道相对路径和绝对路径吗?如果不知道,请阅读它们:D)

@font-face {
   src: url('/EBGaramondSC-webfont.eot');
}

注意/?

它应该是:

src: url('/templates/EBGaramondSC-webfont.eot');

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

src: url('EBGaramondSC-webfont.eot');

打开 Chrome 检查器(输出 404 警告)告诉我:

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

所以,是的,那个!祝你好运。

于 2012-06-25T03:35:31.347 回答
1

查看您的站点和代码,它正在尝试从 / 加载字体。尝试将 @font-face 声明中的路径更改为 /template/* 并查看它是否有效。

问候, 拉吉

于 2012-06-25T03:35:56.397 回答
0

您只需要更改 CSS 文件,style.css使src属性指向每个字体文件的正确路径:

不正确

src: url('/EBGaramondSC-webfont.eot');

已更正

src: url('/templates/EBGaramondSC-webfont.eot');
于 2012-06-25T03:38:45.697 回答