Font awesome icon showing as square in chrome?

后端 未结 6 1197
生来不讨喜
生来不讨喜 2021-02-20 03:49

I am trying to use a font-awsome icon within a button. The icon works fine in firefox but when I use it in chrome it appears as a square. I have looked around and the only thing

相关标签:
6条回答
  • 2021-02-20 04:14

    If you have everything in the proper place (and you even checked the css to make sure the paths are right and you're wondering if you need a js file), try looking at your HTML:

     <i class="fa-users"></i>
    

    This will show up the square with numbers/letters inside mentioned in the question (instead of the icon).

     <i class="fa fa-users"></i>
    

    This will show your icon! Remember, in version 4.2.0 you have to add the fa class!

    Hope it helps!

    0 讨论(0)
  • 2021-02-20 04:14

    The above answer is correct but I wanted to clarify one step further because I don't think it's clear on the font awesome page for getting started. I added the min.css stylesheet and linked to it in the head section of my page. You'll also need to get the five font files and put them in your "fonts" folder of your project. There should be five files and they will end in:

    .eot .svg .ttf .woff .otf

    I retrieved the files from github here: https://github.com/FortAwesome/Font-Awesome

    0 讨论(0)
  • 2021-02-20 04:16

    I have the same problem and finally I'd found what the problem is. It's because I have override the font-family of the tag <i> to something else.

    0 讨论(0)
  • 2021-02-20 04:22

    I had the same issue. But I fixed it easly.

    In Font Awesome fonts files must be placed in "fonts" directory instead of "font" directory in previous versions.

    0 讨论(0)
  • 2021-02-20 04:25

    Very late answer but this might help another brother out there!

    I found out that this behaviour was solved by NOT having display: block; on the i/.fa element.

    .fa is standard inline-block but I changed it to block for better compatibility for old browsers, but it has to be inline-block or maybe something else similar.

    Hope it helps someone out there!

    0 讨论(0)
  • 2021-02-20 04:30

    For me this issue was due to a stray number 4 in one of my CSS files.

    I was pulling my hair out and used all the fixes dotted around to no avail, but after opening a completely unrelated CSS file and finding the number 4 at the end of the document and removing it it worked perfectly.

    So check every CSS file for stray characters.

    0 讨论(0)
提交回复
热议问题