我需要改变我的应用程序的字体,但我有一个困难的时间做它。
我在assets/font下添加了字体的文件:

然后在styles.scss中:
@include mat-core();
$WebClientTemplateJwtA8-primary: mat-palette($mat-indigo);
$WebClientTemplateJwtA8-accent: mat-palette($mat-pink, A200, A100, A400);
$WebClientTemplateJwtA8-warn: mat-palette($mat-red);
$WebClientTemplateJwtA8-theme: mat-light-theme($WebClientTemplateJwtA8-primary, $WebClientTemplateJwtA8-accent, $WebClientTemplateJwtA8-warn);
@include angular-material-theme($WebClientTemplateJwtA8-theme);
html, body { height: 100%; font-size: 16px; font-size: 1rem; font-family: 'Lato', sans-serif;}但它不适用我的自定义字体。
发布于 2020-07-10 15:12:07
我是一个新手,不能添加评论。
您是否已经参考过css中的字体文件?
为了使用自定义字体,您需要指定以下内容-
@font-face {
font-family: CustomFontFamily;
src: url(assets/font/CustomFont.ttf) format("truetype");
}这可以在glocalstyes.scss/css中完成,也可以为此目的创建另一个css/scss文件,然后在angular.json中的styles部分中指定相同的
您可以在这个答案- How to import a new font into a project - Angular 5中找到更多的细节。
https://stackoverflow.com/questions/62836715
复制相似问题