Search code examples
cssfontsfont-facetruetype

CSS: Font-face not working on Chrome


How can I tell why the font is not being displayed?

I'm in Chrome - so .ttf should work. I checked that I can navigate to the file using my URL bar, and I can download it so permissions are fine.

I have a page that declares a @font-face:

@font-face {
  font-family: 'entypo';
  src: url('/css/fonts/entypo.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

p { font-family: 'entypo'; }

Solution

  • The @font-face cannot be within a block. Common practice is to have it at the top of the CSS file.

    Your source:

    #lookgram {
      @font-face {
        font-family: 'entypo';
        src: url("/entypo.eot");
        src: url("/entypo.eot?#iefix") format("embedded-opentype"), url("/entypo.woff") format("woff"), url("/entypo.ttf") format("truetype"), url("/entypo.svg#entypo") format("svg");
        font-weight: normal;
        font-style: normal;
      }
    
      @font-face {
        font-family: 'entypo_social';
        font-style: normal;
        font-weight: 400;
        src: url("/css/fonts/entypo-social.woff") format("woff");
      }
    
      margin: 0;
      font-family: "Helvetica Neue", Helvetica, Arial, "lucida grande", tahoma, verdana, arial, sans-serif;
    }