Created
December 5, 2011 11:23
-
-
Save edom18/1433284 to your computer and use it in GitHub Desktop.
mixin集
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "utf-8"; | |
////////////////////////////////////////////////////// | |
// defined global variables. | |
$prefixs: -webkit-, -moz-, -ms-, -o-, ''; | |
////////////////////////////////////////////////////// | |
// defined mixins. | |
@mixin addPrefix($prop, $val) { | |
@each $prefix in $prefixs { | |
#{$prefix}#{$prop}: $val; | |
} | |
} | |
@mixin addPrefix4Val($prop, $val) { | |
@each $prefix in $prefixs { | |
#{$prop}: #{$prefix}#{$val}; | |
} | |
} | |
@mixin borderRadius($r: 0) { | |
@include addPrefix(border-radius, $r); | |
} | |
@mixin boxSizing($type: border-box) { | |
@include addPrefix(box-sizing, $type); | |
} | |
@mixin boxFlex { | |
@include addPrefix4Val(display, box); | |
} | |
@mixin gradient($val) { | |
@include addPrefix4Val( | |
background, $val | |
); | |
} | |
////////////////// | |
// debug only | |
body { | |
@include borderRadius(4px); | |
@include boxFlex; | |
@include boxSizing; | |
@include gradient("linear-gradient(180deg, #fff 0%, #000 100%), linear-gradient(180deg, #fff 0%, #000 100%)"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment