简体   繁体   English

为什么这个CSS字体代码不加载字体?

[英]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. 我在CSS中编写了以下代码来加载字体。 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 除非您使用的是IE,否则无需参考.eot字体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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