1

I am using @font-face like this:

@font-face {
    font-family: DINPro;
    font-weight: bold;
    src: url(../res/fonts/DINPro-Bold.otf) format("opentype");
}
@font-face {
    font-family: DINPro;
    src: url(../res/fonts/DINPro-Regular.otf) format("opentype");
}
@font-face {
    font-family: DFLiHei;
    src: url(../res/fonts/DFLiHei-Regular.ttf) format('truetype');
}
h1{
    font-family: DFLiHei !important;
}

But not working. My folder structure is likely:

/index.html
/css/style.css
/res/fonts/DINPro-Bold.otf
/res/fonts/DINPro-Regular.otf
/res/fonts/DFLiHei-Regular.ttf

Therefore, I think wrong directory is not my problem. Also, not only fail in special browser, but also in chrome and mobile. Any idea?

Jacky Lau
  • 545
  • 4
  • 17

1 Answers1

0

Convert ttf to woff format

Try this

@font-face {
    font-family: DFLiHei;
    src: url(../res/fonts/DFLiHei-Regular.woff) format('woff');
}

It will work in all browsers

Amal
  • 3,340
  • 1
  • 10
  • 19