{"id":71830,"date":"2020-01-10T17:04:38","date_gmt":"2020-01-10T11:34:38","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?p=71830"},"modified":"2024-04-12T14:22:45","modified_gmt":"2024-04-12T08:52:45","slug":"angular-7-materials-typography","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/","title":{"rendered":"Angular 7 Material&#8217;s Typography"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-developer-tutorials\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to Tutorial<\/a><\/p>\n\n\n<p>Typography is a way of arranging type to make text legible, readable, and appealing when displayed. Angular Material&#8217;s typography is based on the guidelines from the Material Design spec and is arranged into typography levels. Each level has a font-size, line-height and font-weight. The available levels are:<\/p>\n<ul>\n<li>display-4, display-3, display-2 and display-1 &#8211; Large, one-off headers, usually at the top of the page (e.g. a hero header).<\/li>\n<li>headline &#8211; Section heading corresponding to the &lt;h1&gt; tag.<\/li>\n<li>title &#8211; Section heading corresponding to the &lt;h2&gt; tag.<\/li>\n<li>subheading-2 &#8211; Section heading corresponding to the &lt;h3&gt; tag.<\/li>\n<li>subheading-1 &#8211; Section heading corresponding to the &lt;h4&gt; tag.<\/li>\n<li>body-1 &#8211; Base body text.<\/li>\n<li>body-2 &#8211; Bolder body text.<\/li>\n<li>caption &#8211; Smaller body and hint text.<\/li>\n<li>button &#8211; Buttons and anchors.<\/li>\n<li>input &#8211; Form input fields.<\/li>\n<\/ul>\n<p>The typography levels are collected into a typography config which is used to generate the CSS.<\/p>\n<p>Usage<\/p>\n<p>To get started, you first include the Roboto font with the 300, 400 and 500 weights. You can host it yourself or include it from Google Fonts:<\/p>\n<p>&lt;link href=&#8221;https:\/\/fonts.googleapis.com\/css?family=Roboto:300,400,500&#8243; rel=&#8221;stylesheet&#8221;&gt;<\/p>\n<p>Now you can add the appropriate CSS classes to the elements that you want to style:<\/p>\n<p>&lt;h1 class=&#8221;mat-display-1&#8243;&gt;Jackdaws love my big sphinx of quartz.&lt;\/h1&gt;<\/p>\n<p>&lt;h2 class=&#8221;mat-h2&#8243;&gt;The quick brown fox jumps over the lazy dog.&lt;\/h2&gt;<\/p>\n<p>By default, Angular Material doesn&#8217;t apply any global CSS. To apply the library&#8217;s typographic styles more broadly, you can take advantage of the mat-typography CSS class. This class will style all descendant native elements.<\/p>\n<p>&lt;!&#8211; By default, Angular Material applies no global styles to native elements. &#8211;&gt;<\/p>\n<p>&lt;h1&gt;This header is unstyled&lt;\/h1&gt;<\/p>\n<p>&lt;!&#8211; Applying the mat-tyography class adds styles for native elements. &#8211;&gt;<\/p>\n<p>&lt;section class=&#8221;mat-typography&#8221;&gt;<\/p>\n<p>&lt;h1&gt;This header will be styled&lt;\/h1&gt;<\/p>\n<p>&lt;\/section&gt;<\/p>\n<h3><strong>Customization<\/strong><\/h3>\n<p>Typography customization is an extension of Angular Material&#8217;s Sass-based theming. Similar to creating a custom theme, you can create a custom typography configuration.<\/p>\n<p>@import &#8216;~@angular\/material\/theming&#8217;;<\/p>\n<p>\/\/ Define a custom typography config that overrides the font-family as well as the<\/p>\n<p>\/\/ `headlines` and `body-1` levels.<\/p>\n<p>$custom-typography: mat-typography-config(<\/p>\n<p>$font-family: &#8216;Roboto, monospace&#8217;,<\/p>\n<p>$headline: mat-typography-level(32px, 48px, 700),<\/p>\n<p>$body-1: mat-typography-level(16px, 24px, 500)<\/p>\n<p>);<\/p>\n<p>As the above example demonstrates, a typography configuration is created by using the mat-typography-config function, which is given both the font-family and the set of typographic levels described earlier. Each typographic level is defined by the mat-typography-level function, which requires a font-size, line-height, and font-weight. Note that the font-family has to be in quotes.<\/p>\n<p>Once the custom typography definition is created, it can be consumed to generate styles via different Sass mixins.<\/p>\n<p>\/\/ Override typography CSS classes (e.g., mat-h1, mat-display-1, mat-typography, etc.).<\/p>\n<p>@include mat-base-typography($custom-typography);<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ Override typography for a specific Angular Material components.<\/p>\n<p>@include mat-checkbox-typography($custom-typography);<\/p>\n<p>\/\/ Override typography for all Angular Material, including mat-base-typography and all components.<\/p>\n<p>@include angular-material-typography($custom-typography);<\/p>\n<p>If you&#8217;re using Material&#8217;s theming, you can also pass in your typography config to the mat-core mixin:<\/p>\n<p>\/\/ Override the typography in the core CSS.<\/p>\n<p>@include mat-core($custom-typography);<\/p>\n<p><strong>Material typography in your custom CSS<\/strong><\/p>\n<p>Angular Material includes typography utility mixins and functions that you can use to customize your own components:<\/p>\n<ul>\n<li>mat-font-size($config, $level) &#8211; Gets the font-size, based on the provided config and level.<\/li>\n<li>mat-font-family($config) &#8211; Gets the font-family, based on the provided config.<\/li>\n<li>mat-line-height($config, $level) &#8211; Gets the line-height, based on the provided config and level.<\/li>\n<li>mat-font-weight($config, $level) &#8211; Gets the font-weight, based on the provided config and level.<\/li>\n<li>mat-typography-level-to-styles($config, $level) &#8211; Mixin that takes in a configuration object and a typography level, and outputs a short-hand CSS font declaration.<\/li>\n<\/ul>\n<p>@import &#8216;~@angular\/material\/theming&#8217;;<\/p>\n<p>\/\/ Create a config with the default typography levels.<\/p>\n<p>$config: mat-typography-config();<\/p>\n<p>\/\/ Custom header that uses only the Material `font-size` and `font-family`.<\/p>\n<p>.unicorn-header {<\/p>\n<p>font-size: mat-font-size($config, headline);<\/p>\n<p>font-family: mat-font-family($config);<\/p>\n<p>}<\/p>\n<p>\/\/ Custom title that uses all of the typography styles from the `title` level.<\/p>\n<p>.unicorn-title {<\/p>\n<p>@include mat-typography-level-to-styles($config, title);<\/p>\n<p>}<\/p>\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-developer-tutorials\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to Tutorial<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go back to Tutorial Typography is a way of arranging type to make text legible, readable, and appealing when displayed. Angular Material&#8217;s typography is based on the guidelines from the Material Design spec and is arranged into typography levels. Each level has a font-size, line-height and font-weight. The available levels are: display-4, display-3, display-2 and&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[8294],"tags":[8379],"class_list":["post-71830","page","type-page","status-publish","hentry","category-angular-7","tag-angular-7-materials-typography"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Angular 7 Material&#039;s Typography - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular 7 Material&#039;s Typography - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Go back to Tutorial Typography is a way of arranging type to make text legible, readable, and appealing when displayed. Angular Material&#8217;s typography is based on the guidelines from the Material Design spec and is arranged into typography levels. Each level has a font-size, line-height and font-weight. The available levels are: display-4, display-3, display-2 and...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:52:45+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/\",\"name\":\"Angular 7 Material's Typography - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2020-01-10T11:34:38+00:00\",\"dateModified\":\"2024-04-12T08:52:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Angular 7 Material&#8217;s Typography\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular 7 Material's Typography - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/","og_locale":"en_US","og_type":"article","og_title":"Angular 7 Material's Typography - Tutorial","og_description":"Go back to Tutorial Typography is a way of arranging type to make text legible, readable, and appealing when displayed. Angular Material&#8217;s typography is based on the guidelines from the Material Design spec and is arranged into typography levels. Each level has a font-size, line-height and font-weight. The available levels are: display-4, display-3, display-2 and...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:52:45+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/","name":"Angular 7 Material's Typography - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2020-01-10T11:34:38+00:00","dateModified":"2024-04-12T08:52:45+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/angular-7-materials-typography\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Angular 7 Material&#8217;s Typography"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/71830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=71830"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/71830\/revisions"}],"predecessor-version":[{"id":87912,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/71830\/revisions\/87912"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=71830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=71830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=71830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}