I have three font type -Gotham-bold, Gotham-medium, Gotham-thin, so do I need to use three times @font-face?

前端 未结 2 1310
无人共我
无人共我 2021-02-11 02:40

Actually I have three files in the fonts folder. These are Gotham-Bold.ttf, Gotham-Medium.ttf, Gotham-Thin.ttf..... So do I need to use th

2条回答
  •  庸人自扰
    2021-02-11 03:45

    Yes, you need to declare each font-type as a separate @fontface. Each would be a different font-family in that case.

    Like so:

    @font-face {
      font-family: 'GothamThin';
      /* links to all gotham thin files, font-weight/style declaration */
    }
    @font-face {
      font-family: 'GothamMedium';
      /* links to all gotham medium files, font-weight/style declaration */
    }
    @font-face {
      font-family: 'GothamBold';
      /* links to all gotham bold files, font-weight/style declaration */
    }
    

    Only include the fonts you are using, though.. if you don't use Gotham Thin anywhere on the page, don't include it (for speed).

提交回复
热议问题