标签: angular-material-11

我们可以在 Angular 材料排版中定义排版的自定义级别吗

根据 Angular Material 排版,排版有 13 个定义级别:文档

例如display-4、display-3、display-2、标题、标题等。

默认情况下,这些级别有一些预定义的字体大小、行高和字母间距。我们可以为每个级别自定义字体,如下所示:

@import '~@angular/material/theming';

// Define a custom typography config that overrides the font-family as well as the
// `headlines` and `body-1` levels.
$custom-typography: mat-typography-config(
  $font-family: 'Roboto, monospace',
  $headline: mat-typography-level(32px, 48px, 700),
  $body-1: mat-typography-level(16px, 24px, 500)
  $caption: mat-typography-level(10px, 16px, 400),
);

// Override the typography in the core CSS.
@include mat-core($custom-typography);
Run Code Online (Sandbox Code Playgroud)

例如,如果我的项目样式指南中有大标题级别,如何将该级别添加到自定义功能中?

我可以通过定义自己的 CSS 类来做到这一点,但是有什么复杂的方法可以做到这一点吗?

angular-material angular angular-material-11

7
推荐指数
1
解决办法
8459
查看次数