To use local font in HTML using font face

后端 未结 3 1264
傲寒
傲寒 2020-12-29 08:25

I trying to use local font to apply styles in html, below is the code.Font is not getting applied for harlow class used element




        
3条回答
  •  伪装坚强ぢ
    2020-12-29 08:49

    Use font face in all the format types according to the browser compatibility

    - Just add bellow code before all the styling of your css file and then you can use this font family for any selector inside within your css file.

    @font-face {
             font-family: 'CustomHeading';
             src: url('./fonts/SFAtarianSystem.ttf') format('embedded-opentype'), /* Internet Explorer */
             url('./fonts/SFAtarianSystem.ttf') format('woff2'), /* Super Modern Browsers */
             url('./fonts/SFAtarianSystem.ttf') format('woff'), /* Pretty Modern Browsers */
             url('./fonts/SFAtarianSystem.ttf')  format('truetype'), /* Safari, Android, iOS */
             url('./fonts/SFAtarianSystem.ttf') format('svg'); /* Legacy iOS */
    }
    

提交回复
热议问题