Ali*_*ari 2 fonts sass angular
我想将一堆自定义字体包含在我的网络应用程序中。我已将它们放在 src 中的 asset/fonts 文件夹中,但我不确定如何将它们实际包含在我的项目中
我在 styles.scss 中添加了以下内容,它可以编译但不会更改我的字体:
body {
font: Custom;
}
@font-face {
font-family: Custom;
src: url('assets/fonts/Custom.otf') format('opentype');
}
Run Code Online (Sandbox Code Playgroud)
找到了解决方案。
自定义需要用引号括起来,并且!对于覆盖当前字体很重要
body {
font-family: 'Custom', Fallback, sans-serif !important;
}
@font-face {
font-family: 'Custom';
src: url('assets/fonts/Custom.otf') format('opentype');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4955 次 |
| 最近记录: |