📜  如何在 React 项目中包含自定义字体 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:27.503000             🧑  作者: Mango

代码示例2
/*Create a directory "fonts" in your src folder
Move your font files in the "fonts" directory
Create / In your App.css file, you can use them as followed
*/

@font-face {
  font-family: 'MyFont';
  src: local('MyFont'), url(./fonts/MyFont.woff) format('woff');
  /* other formats include: 'woff2', 'truetype, 'opentype',
                            'embedded-opentype', and 'svg' */
}

/*Import the App.css file in your App.js*/