kyw*_*kyw 1 angular-cli angular-material2 angular
我想改用Lato.我试图在增加它index.html和styles.css,但不工作.
我发现的最好方法是将所有Angular Material 2选择器定位如下:
body [class^='mat-'], body [class*=' mat-'] {
font-family: "lato";
}
Run Code Online (Sandbox Code Playgroud)
这是因为角度2的组件都有一个以"mat-"开头的类.
以 @Ben Taliadoros 的答案为基础,这将防止材质图标损坏:
body [class^='mat-'], body [class*=' mat-'] {
font-family: 'PT Sans', sans-serif;
}
body .material-icons {
font-family: 'Material Icons';
}
Run Code Online (Sandbox Code Playgroud)
CSS 语法信息:
来源: https: //www.w3schools.com/cssref/css_selectors.asp
小智 1
我有同样的问题@kyw。目前唯一的方法是在需要时覆盖每个组件中的字体。
添加后替换了组件中的一些字体:
html * {
font-family: "lato", sans-serif;
font-style: normal;
font-weight: 400;
}
Run Code Online (Sandbox Code Playgroud)
希望有人能给我们更好的提示。
| 归档时间: |
|
| 查看次数: |
2081 次 |
| 最近记录: |