Skip to content

Instantly share code, notes, and snippets.

@jpmckinney
Created December 31, 2011 20:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jpmckinney/1545194 to your computer and use it in GitHub Desktop.
Save jpmckinney/1545194 to your computer and use it in GitHub Desktop.
CSS3 SCSS Mixins
// blog post: http://blog.slashpoundbang.com/post/15096433153/css3-scss-mixins
// Mixins ----------------------------------------------------------------------
// http://css3please.com/
@mixin background-rgba($red, $green, $blue, $opacity, $rgba) {
background-color: transparent;
background-color: rgba($red, $green, $blue, $opacity);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$rgba}',endColorstr='#{$rgba}');
zoom: 1;
}
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
border-radius: $radius;
}
@mixin border-direction-radius($direction, $radius) {
-webkit-border-#{$direction}-radius: $radius;
-moz-border-#{$direction}-radius: $radius;
border-#{$direction}-radius: $radius;
}
@mixin box-shadow($value) {
-webkit-box-shadow: $value;
-moz-box-shadow: $value;
box-shadow: $value;
}
@mixin transition($value) {
-webkit-transition: $value;
-moz-transition: $value;
-ms-transition: $value;
-o-transition: $value;
transition: $value;
}
@mixin opacity($opacity) {
filter: alpha(opacity=$opacity * 100);
-khtml-opacity: $opacity;
-moz-opacity: $opacity;
opacity: $opacity;
}
@mixin gradient($from, $to) {
background-color: $to;
background-repeat: repeat-x;
background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
background-image: -webkit-linear-gradient(top, $from, $to);
background-image: -moz-linear-gradient(top, $from, $to);
background-image: -ms-linear-gradient(top, $from, $to);
background-image: -o-linear-gradient(top, $from, $to);
background-image: linear-gradient(top, $from, $to);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment