CSS - @ font-face

时间:2015-10-29 07:25:07

标签: css fonts font-face

以下代码有问题吗?:

当我在网页中加载此字体时,字体不起作用。

@font-face {
    font-family: 'yekan';
    src: url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.eot');
    src: url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.eot?#iefix') format('embedded-opentype'),
         url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.woff2') format('woff2'),
         url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.woff') format('woff'),
         url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.ttf') format('truetype'),
         url('http://yekandroidi.persiangig.com/other/ip-address/fonts/byekan-webfont.svg#yekan') format('svg');
    font-weight: normal;
    font-style: normal;

}

p {
    font-family: yekan; /*nothing appear*/
}

1 个答案:

答案 0 :(得分:1)

来自“http://yekandroidi.persiangig.com”的字体已被跨源资源共享策略阻止加载:请求的资源上没有“Access-Control-Allow-Origin”标头

在服务器上启用CORS,或使用其他URL访问字体