繁体   English   中英

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

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

我在CSS中编写了以下代码来加载字体。 路径是双重检查,它们很好,但我不知道它为什么不加载它们。 它工作到几天前。 现在,它不起作用。 这是书面代码:

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

解:

您将错误的格式引用到错误的字体文件。 修正如下:

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

}

这可能有用

@font-face {
font-family: 'yekan';
src: url('fonts/WebYekan.eot?#') format('eot'),
url('fonts/WebYekan.ttf') format('truetype'), 
url('fonts/WebYekan.woff') format('woff');
}
  • 检查网络选项卡以查看是否正在引用这些文件
  • 如果您需要这些字体那么糟糕,那么获取本地副本并引用它们
  • 除非您使用的是IE,否则无需参考.eot字体

暂无
暂无

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

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