字体真棒不显示图标 [英] Font awesome is not showing icon

查看:145
本文介绍了字体真棒不显示图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Font Awesome,并不希望使用HTTP添加CSS。我下载了Font Awesome并将其包含在我的代码中,但Font Awesome显示的是边框方框而不是图标。这里是我的代码:

I am using Font Awesome and do not wish to add CSS with HTTP. I downloaded Font Awesome and included it in my code, yet Font Awesome is showing a bordered square box instead of an icon. Here is my code:

<html>
<head>
<link rel="stylesheet" href="../css/font-awesome.css">
    <link rel="stylesheet" href="../css/font-awesome.min.css">
</head>
<body>
<div style="font-size: 44px;">
   <i class="fa fa-camera-retro fa-lg"></i> fa-lg
<i class="fa fa-camera-retro fa-2x"></i> fa-2x
</div>
</body>
</html>

我想知道如何显示图标,而不是有边框的方框。

I would like to know how to make the icon display instead of the bordered square box.

推荐答案

在我的情况下,我在我的css代码中犯了以下错误。

In my case i made the following mistake in my css code.

*{
    font-family: 'Open Sans', sans-serif !important;
}

这将覆盖整个页面的所有字体系列规则。
我的解决方案是像这样将代码移动到body。

This will override all font family rules for the entire page. My solution was to move the code to body like so.

body{
    font-family: 'Open Sans', sans-serif;
}

注意:每当你使用!important css中的标志,在同一元素上声明的相同类型的任何其他css规则都将被覆盖。

NB: Whenever you use the !important flag in css, any other css rule declared of the same type on the same element will get overriden.

这篇关于字体真棒不显示图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆