Is the MDC typography specific to the Roboto font, or can we implement with other Google fonts and if so, is the recommended way simply to apply the font-family
CSS to body
?
Lastly, it appears that all header elements are tied to the <h1>
element which seems to break the semantic nature of HTML5, i.e. h1
normally has higher significance than h5
.
MDC-Web is a customizable library, and given the fact that Google doesn't prohibit using your brand styles along with Material Design framework, you're free to use any font, not just "Roboto".
If you're using CSS-only approach, adding
font-family
tobody
is not enough: MDC-Web applies default typography styles (includingfont-family
) to different components (e.g.,mdc-button
,mdc-list
,mdc-card
) and typography classes, and they still will have “Roboto” font applied. So, if you’re going to use such MDC-Web components and classes, you need to manually specifyfont-family
for each of them:But this might be tedious, so the recommended way to generate MDC-Web styling is to use Sass. Specifically, you need to override MDC-Web’s typography variable in your
.scss
file before importing the component:Another method is described in the MDCv2 developer documentation:
This method leverages Sass module variables.