我有一个scss文件,以这种方式实现字体导入:
@import url(https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700&subset=latin-ext,cyrillic);
Run Code Online (Sandbox Code Playgroud)
我知道使用CDN可以为用户提供缓存优势,但这是内部站点,可以在服务器上使用而无需访问wide web.而且我不确定用户机器是否也可以访问Internet.所以我想用其他页面静态文件服务前端.
SCSS中有没有办法从服务器上的某个目录导入字体?就像是:
@import dir(/path/to/fonts/file)
Run Code Online (Sandbox Code Playgroud)
或者SCSS没有这个功能?
JTr*_*x16 23
据我所知,您无法@import在SCSS中导入字体.您可以使用包含字体@font-face.例如:
@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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30712 次 |
| 最近记录: |