1

我在这里使用 compass sass 写下一个模板,字体混合在没有设置网络字体的情况下会产生一些问题。我的配置文件就像

http_path = "/"
css_dir = "resources/stylesheets"
sass_dir = "resources/stylesheets" 
images_dir = "resources/images"
javascripts_dir = "resources/js"

然后通过使用字体混合生成的输出是

@font-face {
 font-family: "cabinregular";
src: url('resources/stylesheets/fonts/cabin-regular.eot?#iefix') format('embedded- 
opentype'), url('resources/stylesheets/fonts/cabin-regular.ttf') format('truetype'),
 url('resources/stylesheets/fonts/cabin-regular.woff') format('woff');
 } 

路径是正确的,但在运行 html 时字体将不适用。但是如果我指定 http 路径,例如

   http_path="/somename/"

它适用。那么为什么不指定 http_path 就无法工作..?

4

1 回答 1

3

src: url("../fonts/cabin-regular?#iefix");在主 src 之前带来 工作正常

@font-face {
  font-family: 'cabinregular';
  src: url("../fonts/cabin-regular?#iefix");
  src: url("../fonts/cabin-regular?#iefix") format("embedded-opentype"), url("../fonts/cabin-regular") format("woff"), url("../fonts/cabin-regular") format("truetype"), url("../fonts/cabin-regular.svg#cabin-regular") format("svg");
  font-weight: normal;
  font-style: normal;
}
于 2013-11-26T07:00:32.717 回答