vue、css引入字体文件使用
下载字体:https://www.fontke.com/
字体转换器:https://www.fontke.com/tool/convfont/
下载字体:https://www.fontke.com/
下载之后复制里边的.ttf文件
编辑器检查 css 错误的时候,总是提示“font property font-family does not have generic default”,编辑器是根据W3C标准来提示的,原来是因为没有定义 “generic-family”即 字体的所属风格。
例如:serif,sans-serif,cursive。
加上generic-family就好了,中文用serif 或 sans-serif。
示例
body{font-family:”宋体”,serif;}
————————————————
版权声明:本文为CSDN博主「怪小弟」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/gxdvip/article/details/51830279
code
/Users/scholar/Desktop/zjhb/new-water/ecology-screen/src/assets/less/common/_base.less
@font-face {
font-family: ‘myFont01’;
src: url(../../font/style01.ttf);
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: ‘myFont02’;
src: url(../../font/STHUPO.TTF);
font-weight: normal;
font-style: normal;
}
使用
.title {
font-family: ‘myFont01’, serif;
}