Vue project imports external fonts


1. The vue project introduces external fonts

1. Download the font package online

insert image description here

2. Import fonts into the project

insert image description here

3. Then create a font.css file in the css folder, which is used to declare the imported font and define the font name

@font-face {
    
    
  font-family: 'Source Han Sans CN-Medium'; 
  src: url('../font/SourceHanSansSC-Medium.otf'); 
  font-weight: normal;
  font-style: normal;
}

@font-face {
    
    
  font-family: 'Source Han Serif SC-Bold'; 
  src: url('../font/SourceHanSansSC-Bold.otf'); 
  font-weight: normal;
  font-style: normal;
}

4. Introduce font.css file in main.js

insert image description here

5. Use in css

insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/qq_35971976/article/details/125778277