在我的css文件中
@font-face {
url('fontpu/anmo000-webfont.woff') format('woff'),
url('fontpu/anmo000-webfont.ttf') format('truetype'),
}
.punjabi{
font-family: 'anmollipiregular';
}
然后我在我的AppAsset类中注册了这个。
public $css = [
'css/site.css',
'css/punjabi.css',
];
CCD_ 1文件夹位于CCD_ 2文件夹(包含index.php的网络可访问文件夹)中
如果我将css放在index.php
中的<style>
标记下,字体可以正常工作,但在发布资产时,它不会加载。如何给出字体的路径?
根据W3:
部分URL是相对于样式表的源进行解释的,而不是相对于文档
您应该简单地使用正确的相对路径:
url('../fontpu/anmo000-webfont.woff') format('woff'),
url('../fontpu/anmo000-webfont.ttf') format('truetype'),