2

Why font-awesome works on localhost but not on web ?

Help Please!!

@font-face {
  font-family: 'FontAwesome';
  src: url('font/fontawesome-webfont.eot@v=3.0.1');
  src: url('font/fontawesome-webfont.eot@#iefix&v=3.0.1') format('embedded-opentype'),
    url('font/fontawesome-webfont.woff@v=3.0.1') format('woff'),
    url('font/fontawesome-webfont.ttf@v=3.0.1') format('truetype');
  font-weight: normal;
  font-style: normal;
}

3 Answers3

1

I found the fix to this issue from here: It was answered by someone named Thorst about halfway down the page.

Saved me a ton of frustration!

In case the link goes stale->

change font-awesome.css

From:

src: url('../font/fontawesome-webfont.eot?#iefix') format('eot'),
 url('../font/fontawesome-webfont.woff') format('woff'),
 url('../font/fontawesome-webfont.ttf') format('truetype'),
 url('../font/fontawesome-webfont.svg#FontAwesome') format('svg');

To:

 src: url('../font/fontawesome-webfont.eot?#iefix')
 format('embedded-opentype'), url('../font/fontawesome-webfont.woff')
 format('woff'), url('../font/fontawesome-webfont.ttf')
 format('truetype'), url('../font/fontawesome-webfont.svg#FontAwesome')
 format('svg');

*Note: the format for the eot is what was changed.

StuckOverflow
  • 991
  • 2
  • 10
  • 21
1

If your font-awesome files are on a different server than your web page, you may be getting a CORS (Cross-Origin Resource Sharing) error in your browser. You can either use the MaxCDN server or modify your server (that provides the font-awesome files) to include a Access-Control-Allow-Origin:* header with the font files. See my answer for Font Awesome icons not showing in Chrome, a MaxCDN related Cross-Origin Resource Sharing policy issue

Community
  • 1
  • 1
Brent Washburne
  • 12,904
  • 4
  • 60
  • 82
0

I've never seen the use of @ signs like that. Try using question marks in their place:

@font-face {
  font-family: 'FontAwesome';
  src: url('font/fontawesome-webfont.eot?v=3.0.1');
  src: url('font/fontawesome-webfont.eot?v=3.0.1#iefix') format('embedded-opentype'),
    url('font/fontawesome-webfont.woff?v=3.0.1') format('woff'),
    url('font/fontawesome-webfont.ttf?v=3.0.1') format('truetype');
  font-weight: normal;
  font-style: normal;
}

On line 4, I've also also swapped the order of #iefix and v=3.0.1, and removed the &.

Josh Goodwin
  • 181
  • 1
  • 6