Tried to add a .ttf file and link to it. Result "sans-serif", not "Karla, sans-serif"

@font-face{ font-family: 'Karla'; src: url("app/fonts/karla/Karla-Regular.ttf") } p { font-family: 'Karla', sans-serif; } 

    3 answers 3

    Wouldn't it help if you add format("truetype") after url("…ttf") ?

     @font-face{ font-family: 'Karla'; src: url("app/fonts/karla/Karla-Regular.ttf") format("truetype"); } 

    By the way, you can use a service like this , generate valid CSS and at the same time convert the font to other formats for different browsers.

      Strange, I always connect it.

      Maybe your font path is not correctly specified (the "send" point is the css file itself)?

      For example, my font connects like this:

       @font-face { font-family: 'PT Sans'; font-weight: normal; src: url('../fonts/PT_Sans-Web-Regular.ttf'); } 

      The file layout structure is as follows:

       /css/style.css /fonts/PT_Sans-Web-Regular.ttf /index.html 

        Perhaps you just need to put a semicolon ;

         src: url("app/fonts/karla/Karla-Regular.ttf") 
        • Yes, it seems no ... - Qwertiy
        • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky