angular2-cli include custom fonts

前端 未结 5 1250
悲&欢浪女
悲&欢浪女 2020-12-25 11:25

I am trying to include some custom fonts in my project with no success.

NOTE: I am using angular-cli: angular-cli@1.0.0-beta.21

  1. I put the fonts in

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-25 12:26

    Have you tried using the googlefont url from https://fonts.google.com?

    In your styles.css:

    @import url('https://fonts.googleapis.com/css?family=Roboto');
    

    Then use the font-family in styles.css or wherever you need:

    body, html {
      font-family: 'Roboto';
    }
    

    I'm using this in my project and it works nicely.

提交回复
热议问题