Font awesome icon showing as square in chrome?

*爱你&永不变心* 提交于 2019-12-04 02:52:24

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.

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!

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

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.

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.

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!