前端项目中经常使用到各种各样的字体样式,此处以DS-Digital为例,先放效果图,
1、DS-Digital字体资源,在如下链接中下载,然后解压
链接: https://pan.baidu.com/s/1yG-asAfmqAN96UTXsXW9Iw 提取码: ex98 复制这段内容后打开百度网盘手机App,操作更方便哦
2、将解压后的文件放入项目根目录,如下
3、在需要文件中引入,此处写了一个demo
直接使用style="font-family: DS-Digital;"就可以使用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
@font-face {
font-family: 'DS-Digital';
src:
url(/teduvue1/zwwvue/public/fonts/DS-Digital/DS-DIGIT-4.ttf),
url(/teduvue1/zwwvue/public/fonts/DS-Digital/DS-DIGII-3.ttf),
url(/teduvue1/zwwvue/public/fonts/DS-Digital/DS-DIGIB-2.ttf),
url(/teduvue1/zwwvue/public/fonts/DS-Digital/DS-DIGI-1.ttf);
}
</style>
<script src="vue.js" type="text/javascript" charset="UTF-8"></script>
</head>
<body>
<div id="app" style=" background-color: aliceblue; width: 1000px; height:500px">
erefefeeeeeeeeeeeef
<span style="font-family: DS-Digital;">erefefeeeeeeeeeeeef{{da}}</span>
</div>
<script>
var app = new Vue({
el: "#app",
data: {
da: 'eefffff2',
},
});
</script>
</body>
</html>