Using custom fonts using CSS?

后端 未结 8 740
余生分开走
余生分开走 2020-11-22 09:01

I\'ve seen some new websites that are using custom fonts on their sites (other than the regular Arial, Tahoma, etc.).

And they support a nice amount of browsers.

8条回答
  •  执笔经年
    2020-11-22 09:36

    Today there are four font container formats in use on the web: EOT, TTF, WOFF,andWOFF2.

    Unfortunately, despite the wide range of choices, there isn't a single universal format that works across all old and new browsers:

    • EOT is IE only,
    • TTF has partial IE support,
    • WOFF enjoys the widest support but is not available in some older browsers
    • WOFF 2.0 support is a work in progress for many browsers.

    If you want your web app to have the same font across all browsers then you might want to provide all 4 font type in CSS

     @font-face {
          font-family: 'besom'; !important
          src: url('fonts/besom/besom.eot');
          src: url('fonts/besom/besom.eot?#iefix') format('embedded-opentype'),
               url('fonts/besom/besom.woff2') format('woff2'),
               url('fonts/besom/besom.woff') format('woff'),
               url('fonts/besom/besom.ttf') format('truetype'),
               url('fonts/besom/besom.svg#besom_2regular') format('svg');
          font-weight: normal;
          font-style: normal;
      }
    

提交回复
热议问题