码迷,mamicode.com
首页 > 其他好文 > 详细

sass中常用mixin

时间:2015-06-29 06:08:15      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

//设置字体大小
@mixin font($s:14px,$h:1.5,$f:microsoft yahei){
    font:$s/#{$h} $f;
}

//设置水平居中
@mixin horizontal-center {
    margin-left: auto;
  margin-right: auto;
}

//参数(方向,大小,颜色),默认:向下,10px,红色
%arrow{
    width:0;
    height:0;
    line-height:0;
    font-size: 0;
    overflow:hidden;
    display: inline-block;
}
@mixin arrow($d:bottom,$s:10px,$c:red){
    border:#{$s} dotted transparent;
    @if $d=="top"{
        border-bottom:#{$s} dotted #{$c}; 
        border-top:0 none;
    }@else if $d=="right"{
        border-left:#{$s} dotted #{$c}; 
        border-right:0 none;
    }
    @else if $d=="bottom"{
        border-top:#{$s} dotted #{$c}; 
        border-bottom:0 none;
    }
    @else if $d=="left"{
        border-right:#{$s} dotted #{$c}; 
        border-left:0 none;
    }
}

 

sass中常用mixin

标签:

原文地址:http://www.cnblogs.com/liujin0505/p/4606396.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!