Applying typography

There are multiple ways to apply typography. One way is to leverage the mat-typography class and use the corresponding HTML tag like <h2>:

src/app/app.component.ts  <mat-card-header class="mat-typography">  <mat-card-title><h2>Current Weather</h2></mat-card-title></mat-card-header>

Another way is to apply the specific typography directly on an element, like class="mat-title":

src/app/app.component.ts  <mat-card-title><div class="mat-title">Current Weather</div></mat-card-title>
Note that class="mat-title" can be applied to div, span or an h2 with the same results.

As a general rule of thumb, it is usually a better idea to implement the more specific and localized option, which is the second implementation.

Get Angular 6 for Enterprise-Ready Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.