Html 字体真棒图标不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20985396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:23:40  来源:igfitidea点击:

Font awesome icons not working

htmltwitter-bootstrap-3font-awesomebootstrap-4

提问by user972255

I am trying to add a font awesome icon in front of my Delete & Settings link button but its not working. Can someone please tell me what is missing?

我正在尝试在我的“删除和设置”链接按钮前添加一个很棒的字体图标,但它不起作用。有人可以告诉我缺少什么吗?

Html Code:

html代码:

<div class="jumbotron">
    <p>
        <a class="btn btn-danger" href="#">
          <i class="fa fa-trash-o fa-lg"></i> Delete
        </a>
        <a class="btn btn-default btn-sm" href="#">
          <i class="fa fa-cog"></i> Settings
        </a>           
    </p>
  </div>

Added these css:

添加了这些css:

1) bootstrap.min.css 2) font-awesome.min.css

1) bootstrap.min.css 2) font-awesome.min.css

Also, please see the fiddlehere.

另外,请参阅此处的小提琴

回答by Cilan

This is a bug in 3.2.1for site URLs, fixed in 4.0.3. Replace the link external link with http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css

这是3.2.1站点 URL 中的错误,已在4.0.3. 将链接外部链接替换为http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css

(In HTML, it would be <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">)

(在 HTML 中,它是<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">

Check this Fiddle

检查这个小提琴

回答by Mr. HK

Try with this..

试试这个..

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
 
<div class="jumbotron">
    <p>
        <a class="btn btn-danger" href="#">
          <i class="fa fa-trash-o fa-lg"></i> Delete
        </a>
        <br>
        <a class="btn btn-default btn-sm" href="#">
          <i class="fa fa-cog"></i> Settings
        </a>           
    </p>
  </div>

回答by user3664663

I had same problem as yours and I followed the solution from Wobuffetbut it was not working.

我和你有同样的问题,我遵循了Wobuffet的解决方案,但它不起作用。

I added title =""to the element and it fixed my issue:

我添加title =""到元素并解决了我的问题:

<i class="fa fa-pencil" title="Edit"></i> 

回答by tk_

In my case I haven't added the fonts to the project. I found an error in developer console and added below fonts to the location where Font Awesome(font-awesome.min.css) is looking for.

就我而言,我没有将字体添加到项目中。我在开发者控制台中发现了一个错误,并将下面的字体添加到 Font Awesome(font-awesome.min.css) 正在寻找的位置。

Fonts

字体