Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Angular Material what does setting up global typography styles mean?

When using ng add @angular/material to add Material support to an Angular project there is a prompt Set up global Angular Material typography styles?

What does this even mean? The documentation states the prompt appears, but does not describe what it actually means.

like image 655
Neutrino Avatar asked Sep 18 '21 18:09

Neutrino


People also ask

What is global angular material typography styles?

Typography is a way of arranging the text legible, readable, and attractive when displayed. The typology of the angular material is based on the guidelines derived from the material design imagery and organized within the typography level. Each level has a size, line height, and font-weight.

How is typography used in angular materials?

To customize component typography for your entire application, you can pass your custom typography config to the core mixin described in the theming guide. @use '@angular/material' as mat; $my-custom-typography: mat. define-typography-config( $headline: mat. define-typography-level(3rem, 1, 700), ); @include mat.

Which of the following refers to section heading corresponding to the tag as per the angular material's typography?

subheading-1 - Section heading corresponding to the <h4> tag. body-1 - Base body text. body-2 - Bolder body text.


1 Answers

By default, Angular Material doesn’t apply global CSS. Meaning that a standard element (eg. <h1>) will not have Angular materials' styles applied to it. So, when configured this way, in order to apply Angular material styles to a broad section of your HTML, you can use the mat-typography class

<h1>This header doesn't have Angular Material styling</h1>
<section class="mat-typography">
<h1>This header does have Angular Material styling</h1>
</section>

If you set up global typography styles; then the first <h1> will already be styled.

like image 78
LFLFM Avatar answered Nov 04 '22 05:11

LFLFM