1、在assets中新建DINfont文件夹,将字体文件DS-DIGIB.TTF放置到该文件夹下
2、引入字体并定义
@font-face{
font-family: "fontb";
src: url(../../../assets/DINfont/DS-DIGIB.TTF);
}
3、使用
.font {
position: absolute;
top: 40px;
left: 55px;
display: inline-block;
font-family: fontb;
}
4、css设置字体渐变
font-family: fontb;
font-size: 36px;
font-weight: bold;
color: rgba(255, 255, 255, 1);
background: linear-gradient(0deg, rgba(255, 80, 51, 1) 0%, rgba(255, 255, 255, 1) 38.4765625%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
最终实现效果: