Font Include Sass Mixin
来源:互联网 发布:oracle12c数据库安装 编辑:程序博客网 时间:2024/05/21 09:39
前期曾经给大家介绍过一个使用google font的mixin(详见《Google Fonts Sass Mixin》),今天我们再进一步给大家推荐个使用web font的mixin。
使用web font,我们需要使用@font-face导入字体文件,然后才可以使用,@font-face的使用格式如下
@font-face { font-family: <YourWebFontName>; src: <source> [<format>][,<source> [<format>]]*; [font-weight: <weight>]; [font-style: <style>];}因为不能的浏览器支持的字体格式不一致,因此我们需要一股脑导入若干多钟字体格式,貌似下面这样。
@font-face { font-family: 'nfoswjeos3500regular'; src: url('3500-webfont.eot'); src: url('3500-webfont.eot?#iefix') format('embedded-opentype'), url('3500-webfont.woff') format('woff'), url('3500-webfont.ttf') format('truetype'), url('3500-webfont.svg#nfoswjeos3500regular') format('svg'); font-weight: normal; font-style: normal;}太烦躁了,麻烦,作为一个注重效率、喜欢偷懒的程序猿,我们当然得有妙招了,来看看这个mixin。
@mixin importfont($font-family, $font-filename, $font-weight : normal, $font-style :normal, $font-stretch : normal) { @font-face { font-family: '#{$font-family}'; src: url('#{$font-filename}.eot'); src: url('#{$font-filename}.eot?#iefix') format('embedded-opentype'), url('#{$font-filename}.woff') format('woff'), url('#{$font-filename}.ttf') format('truetype'), url('#{$font-filename}.svg##{$font-family}') format('svg'); font-weight: $font-weight; font-style: $font-style; font-stretch: $font-stretch; }}然后如此这般使用
@include importfont('Font Name', 'fonts/fontfilename', 400);有没有瞬间轻松,好的,剩下时间玩个游戏撒。
----------------------------------------------------------
前端开发whqet,关注前端开发,分享相关资源,欢迎点赞,欢迎拍砖。
---------------------------------------------------------------------------------------------------------
7 0
- Font Include Sass Mixin
- Sass的混合-@mixin,@include
- Sass mixin
- scss\sass calc 的mixin&include 处理方法
- Google Fonts Sass Mixin
- sass/scss语法@mixin
- sass揭秘之@mixin,%,@function
- sass中常用的mixin
- Sass中的mixin,function,extend
- SASS Mixin实现响应式布局
- sass移动端常用mixin+function
- sass文件的中的@mixin 和%
- Sass进阶-(数据类型,变量运算,mixin)
- XMixins -- 一个兼容LESS、SASS、Stylus的超级mixin库!
- sass实战演练02 - 嵌套、mixin、变量计算、颜色函数
- 使用Sass的Mixin实现自动添加浏览器前缀
- mixin
- mixin
- 14周【项目2-形状类族的中的纯虚函数】
- *.REP和*.PHO文件是什么文件?为什么在GERBERCAM里导入这两种文件时,无法将元件坐标转出来?
- 第十四周--多态性、虚函数和抽象类
- 黑马程序员_C#中is和as的区别
- GDI windows 编程
- Font Include Sass Mixin
- json的用法
- 阿里云服务器架设OA服务器
- 配置hadoop-1.2.1,含三个节点的集群
- C++:关于class member声明为static的情况
- Cocos2d-x3.0自己写的项目编译笔记
- 记录自己的第一个上线项目
- PowerPCB gerber out时*.rep,*.pho,*.drl,*.lst各表示什么意思,在制板时哪些文件是制板商所需要的?
- PAT A 1079. Total Sales of Supply Chain (25)