我使用默认的Sass / Bourbon mixin font-face.scss,但生成的css错误,因为某些原因将body
标记嵌套在@font-face
下。我生成CSS时没有错误,但字体当然没有显示。
有什么想法吗?
CSS输出:
@font-face {
body {
font-family: AgencyFB Regular;
font-weight: normal;
font-style: normal;
src: url("../../fonts/agency/agencyfb_regular.eot");
src: url("../../fonts/agency/agencyfb_regular.eot?#iefix") format("embedded-opentype"),
url("../../fonts/agency/agencyfb_regular.woff") format("woff"),
url("../../fonts/agency/agencyfb_regular.ttf") format("truetype"),
url("../../fonts/agency/agencyfb_regular.svg#AgencyFB Regular") format("svg");
}
}
SCSS:
body {
@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");
font: $body-font-size;
line-height: $body-line-height;
}
答案 0 :(得分:0)
Cimmanon的链接指出了我正确的方向进行修复。谢谢!
基本上我将@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");
移到任何css标签之外(即:body
)。
然后在font-family: AgencyFB Regular
标记中添加了body
。
像这样:
@include font-face(AgencyFB Regular, "fonts/agency/agencyfb_regular");
body {
font-family: AgencyFB Regular;
font: $body-font-size;
line-height: $body-line-height;
}