CSS引入自定义字体--举例:LED液晶数码字体

1,718 阅读1分钟

web项目中需要用到LCD液晶字体显示数值怎么办?

  1. dafont下载.ttf格式字体

  1. 下载.ttf字体文件到本地,放在font字体文件中

  2. 在css文件中引入字体 一般在整体css文件中引入,例如react项目的index.scss

@font-face {
  font-family: 'led regular';
  src: url('./assets/font/DS-DIGI.TTF');
}
  1. 使用字体
.value {
  font-family: 'led regular';
  letter-spacing: 4px;
  color: #00FFE4;
}