简体   繁体   English

在CSS中使用FontAwesome

[英]Using FontAwesome with CSS

Following the advice I found via Google, I have the following SCSS, the fonts exist in the directory specified, and FontAwesome is used elsewhere successfully with the i tag. 按照我通过Google找到的建议,我有以下SCSS,字体存在于指定的目录中,并且FontAwesome在其他地方成功地与i标记一起使用。

What am I doing wrong here as a literal keeps appearing in my html? 由于文字常出现在我的html中,我在这里做错了什么?

@font-face {
    font-family: "FontAwesome";
        src: url('/fonts/fontawesome-webfont.eot'),
            url('/fonts/fontawesome-webfont.svg'),
            url('/fonts/fontawesome-webfont.ttf'),
            url('/fonts/fontawesome-webfont.woff');
}

$fa-exclamation-triangle: "";

.form-error
{
    color:red !important;
    font-weight: bold;
    padding-top: 3px;
    font-family: "FontAwesome";


    &:before
    {
        content: $fa-exclamation-triangle;
    }
}

input.error
{
    font-weight: normal;
    background: $validation-red;
    color: black;
}

What am I doing wrong here as a literal keeps appearing in my html? 由于文字常出现在我的html中,我在这里做错了什么?

I assume you mean the generated content shows as literally  我认为您的意思是生成的内容按字面意义显示为 ?

Well, CSS does not know named entities, so unless your CSS was embedded into the HTML document directly (which from the preprocessor syntax I assume it's not), this named entity does not get resolved as such, and is meant literally at this point. 好吧,CSS不知道命名实体,因此,除非您将CSS直接嵌入HTML文档(从预处理程序语法中我认为不是这样),否则就不会这样解析此命名实体,并且从字面上看这真的。

The CSS notation for including unicode characters is \\0xxxx , with xxxx being the hexadecimal character code. 包括Unicode字符的CSS表示法是\\0xxxx ,其中xxxx是十六进制字符代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM