简体   繁体   中英

Why this CSS font-face code does not load the font?

I have the written the following code in CSS for it to load the fonts. The path are double checked, they are fine, but I do not know why it does not load them up. it worked until quite several days ago. Now, it does not work. Here is the written code:

    @font-face {
    font-family: 'yekan';
    src: url('fonts/WebYekan.eot?#') format('eot'),
        url('fonts/WebYekan.ttf') format('eot'), 
        url('fonts/WebYekan.woff') format('truetype');
}

Solution:

You were referencing the wrong format to the wrong font files. Fixed it below:

@font-face {
font-family: 'yekan';
src: url('fonts/WebYekan.eot?#') format('eot'),
    url('fonts/WebYekan.ttf') format('truetype'), 
    url('fonts/WebYekan.woff') format('woff');

}

this may work

@font-face {
font-family: 'yekan';
src: url('fonts/WebYekan.eot?#') format('eot'),
url('fonts/WebYekan.ttf') format('truetype'), 
url('fonts/WebYekan.woff') format('woff');
}
  • check the network tab to see if these files are being referenced
  • if you need these fonts so bad then get a local copy and reference them
  • need not reference .eot font unless you are using IE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM