1、网上下载对应的字体文件(一般是eot和ttf格式的)
2、将下载的字体文件放入font文件夹并在font文件夹下新建font.css
3、编辑font.css,内容如下
@font-face {
font-family: 'fashion';
src: url('fashion.eot?#iefix') format('embedded-opentype'),
url('fashion.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
说明:
4、使用:
在main.js中引入font.css。
设置font-family:‘fashion’;
5、关于字体文件浏览器兼容问题
报错情况:“@font-face 未能完成 OpenType 嵌入权限检查。权限必须是可安装的。”
font-face是css3的字体规则,对于浏览器的支持情况如下图
解决问题的办法就是添加一个eot文件,并引入,方法看上面截图。
附上在线字体转换网站:https://www.fontke.com/tool/convfont/