FontAwesome icons not showing. Why?

后端 未结 25 1234
借酒劲吻你
借酒劲吻你 2020-11-29 17:15

Recently I\'ve been developing this website and I\'m trying to put a font awesome icons in it, so it\'s scalable.

The thing is they are not showing up.

Look

相关标签:
25条回答
  • 2020-11-29 18:02

    Try the below two links keep in header tag.

    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
    

    Getting the Icons from the below link :

    <link rel="stylesheet" href="http://fortawesome.github.io/Font-Awesome/3.2.1/assets/font-awesome/css/font-awesome.css">
    
    0 讨论(0)
  • 2020-11-29 18:03

    At first I couldn't get this to work with Font Awesome 5:

    <i class="fa fa-sort-down"></i>
    

    That's why I came here, being unfamiliar with font awesome. So when I looked further I noticed that my issue was merely an issue with the version.

    w3schools helped me out in this case.

    New in Font Awesome 5 is the fas prefix, Font Awesome 4 uses fa.

    The s in fas stands for solid, and some icons also have a regular mode, specified by using the prefix far.

    I already noticed the different files in the FontAwesome css folder, like:

    • all.min.css
    • brands.min.css
    • fontawesome.min.css
    • regular.min.css
    • solid.min.css

    And that's when I realized my mistake. All I had to do was include the appropriate css to the html:

    <link rel="stylesheet" href="~/lib/Font-Awesome/css/fontawesome.min.css">
    <link rel="stylesheet" href="~/lib/Font-Awesome/css/regular.min.css">
    <link rel="stylesheet" href="~/lib/Font-Awesome/css/solid.min.css">
    

    And then reference the correct item:

    <i class="fas fa-sort-down"></i>
    

    This setup works for me. Though not all items have equivalents in each type. This will not work:

    <i class="far fa-sort-down"></i>
    

    As a side note, when you don't want to reference all seperate files then this will suffice:

    <link rel="stylesheet" href="~/lib/Font-Awesome/css/fontawesome.min.css">
    <link rel="stylesheet" href="~/lib/Font-Awesome/css/all.min.css">
    
    0 讨论(0)
  • 2020-11-29 18:06

    To whoever may be checking this out in 2018. I am using font awesome 4.7.0 and I got this issue solved by simply taking out the s in fas as seen in the code <i class="fa fa-[icon-name]"></i>. This was originally <i class="fas fa-[icon-name]"></i>.

    Hope this helps.

    0 讨论(0)
  • 2020-11-29 18:07

    Mine was not working because I wanted an icon which was not released in the FA version I was using.

    This answers why some icons shows but others no.

    Pretty obvious but I guess some people still fall for this. Like me.

    0 讨论(0)
  • 2020-11-29 18:07

    Use this link:

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/brands.min.css" integrity="sha512-AMDXrE+qaoUHsd0DXQJr5dL4m5xmpkGLxXZQik2TvR2VCVKT/XRPQ4e/LTnwl84mCv+eFm92UG6ErWDtGM/Q5Q==" crossorigin="anonymous" />
    
    0 讨论(0)
  • 2020-11-29 18:08

    You must use https for maxcdn.bootstrapcdn.com. Only https on maxcdn support CORS

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" media="screen" />
    
    0 讨论(0)
提交回复
热议问题