Search code examples
htmlcssfont-face

Why aren't my fonts working?


My fonts work on chrome, opera and safari but not ie or firefox. I'm having trouble understanding @font-face, even after reading the other questions about it.

@font-face {
font-family: "TikalSansBlack";
src: url("./fonts/TikalSansBlack.eot?");
src: url("./fonts/TikalSansBlack.woff") format("woff"),
    url("./fonts/TikalSansBlack.ttf")  format("truetype"),
    url("./fonts/TikalSansBlack.svg") format("svg")
    url("./fonts/TikalSansBlack.otf") format("opentype");
}

@font-face {
    font-family: 'TikalSansMedium';
    src: url('./fonts/TikalSansMedium.eot?');
    src: url('./fonts/TikalSansMedium.woff') format('woff'),
        url('./fonts/TikalSansMedium.ttf')  format('truetype'),
        url('./fonts/TikalSansMedium.svg') format('svg')
        url('./fonts/TikalSansMedium.otf') format('opentype');
}

@font-face {
    font-family: 'TikalSansThin';
    src: url('./fonts/TikalSansThin.eot?');
    src: url('./fonts/TikalSansThin.woff') format('woff'),
        url('./fonts/TikalSansThin.ttf')  format('truetype'),
        url('./fonts/TikalSansThin.svg') format('svg')
        url('./fonts/TikalSansThin.otf') format('opentype');
}

here's the website I'm working on


Solution

  • You are missing a comma on the last one of every font

    @font-face {
    font-family: "TikalSansBlack";
    src: url("./fonts/TikalSansBlack.eot?");
    src: url("./fonts/TikalSansBlack.woff") format("woff"),
        url("./fonts/TikalSansBlack.ttf")  format("truetype"),
        url("./fonts/TikalSansBlack.svg") format("svg"),  <<== put comma here
        url("./fonts/TikalSansBlack.otf") format("opentype");
    }
    

    Also i would be concerned about your file path. If you want to go up a level you need two . not one. Maybe this is what's required throughout

     url("../fonts/TikalSansBlack.otf")