颜色不会改变字体图标

时间:2014-09-07 19:49:31

标签: html css font-awesome

我正在尝试更改字体图标颜色,但它没有变化,我尝试通过更改font-size: 50px;来增加字体图标大小,但它确实无法正常工作

HTML

<section id="glyphs"><div class="glyph">
            <div class="glyph-icon airplane70"></div>
            <div class="class-name">.flaticon-airplane70</div></div>
</section>

CSS

@font-face {
font-family: "Flaticon";
src: url("flaticon.eot");
src: url("flaticon.eot#iefix") format("embedded-opentype"),
url("flaticon.woff") format("woff"),
url("flaticon.ttf") format("truetype"),
url("flaticon.svg") format("svg");
font-weight: normal;
font-style: normal;
}
[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {   
font-family: Flaticon;
    font-size: 50px;
font-style: normal;
margin-left: 20px;
}.airplane70:before {
content: "\e000";
    color: #009900;
}
.flaticon-baby110:before {
content: "\e001";
    color: blue;
 }

我从这个网站下载了字体图标http://www.flaticon.com有人帮我们错了吗?我只需要改变图标的​​颜色。

1 个答案:

答案 0 :(得分:0)

尝试添加这样的颜色 CSS:

颜色:黑色;

@font-face {
  font-family: "Flaticon";
  src: url("./Flaticon.eot");
  src: url("./Flaticon.eot?#iefix") format("embedded-opentype"),
       url("./Flaticon.woff2") format("woff2"),
       url("./Flaticon.woff") format("woff"),
       url("./Flaticon.ttf") format("truetype"),
       url("./Flaticon.svg#Flaticon") format("svg");
  font-weight: normal;
  font-style: normal;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
  @font-face {
    font-family: "Flaticon";
    src: url("./Flaticon.svg#Flaticon") format("svg");
  }
}

[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {   
  font-family: "Flaticon";
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  color:black;
  line-height: 1;
  text-decoration: inherit;
  text-rendering: optimizeLegibility;
  text-transform: none;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  font-smoothing: antialiased;
}

.flaticon-reload:before { content: "\f100"; }
.flaticon-download:before { content: "\f101"; }
.flaticon-monitor:before { content: "\f102"; }
.flaticon-chat:before { content: "\f103"; }
.flaticon-glasses:before { content: "\f104"; }
.flaticon-vector:before { content: "\f105"; }