2017-05-02 44 views
4

只是想知道怎樣才能更改默認字體在角料...角料和更改字體

默認爲的Roboto,我無法找到一個方法來更改爲不同的字體。

+0

看這個問題:https://github.com/angular/material2/issues/205 –

+0

材料1和材料2? – Edric

+0

這是材料2 – Nav

回答

8

您可以嘗試在你的CSSSCSS使用* selector

* { 
    font-family: Raleway /*Replace with your custom font*/, sans-serif !important; 
    /*Add the !important to overwrite all elements*/ 
} 

編輯:從2.0.0-beta.7開始,現在有自定義排版方式:

@import '[email protected]/material/theming'; 
$custom-typography: mat-typography-config(
    $font-family: 'Raleway' 
) 

@include angular-material-typography($custom-typography); 

或者(2.0.0-beta.10及以上):

// NOTE: From `2.0.0-beta.10`, you can now pass the typography via the mat-core() mixin: 
@import '[email protected]/material/theming'; 
$custom-typography: mat-typography-config(
    $font-family: 'Raleway' 
) 
@include mat-core($custom-typography); 

More info

+0

你在哪裏把你的style.scss?我收到以下錯誤「功能mat-typography-config不支持關鍵字參數」 –

+0

@TonyScialo檢查我的更新答案。 – Edric

+0

ahhh是的,謝謝加入主題導入爲我工作。謝謝! –