Is it possible to import fonts from the directory with scss?

前端 未结 3 2133
忘了有多久
忘了有多久 2021-02-18 13:10

I have a scss file with font import implemented this way:

@import url(https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700&subset=latin-ext,cyrill         


        
3条回答
  •  囚心锁ツ
    2021-02-18 14:02

    As far as I know you can't import fonts using @import in SCSS. You can include fonts using @font-face. For example:

    @font-face {
        font-family: 'Open Sans';
        src: url(path/to/file) format(Example: 'truetype' or 'opentype' depending on the file extension of your font);
    }
    
    
    // USAGE
    body {
        font-family: 'Open Sans', sans-serif;
    }
    

提交回复
热议问题