Skip to content

Instantly share code, notes, and snippets.

@jimjeffers
Created January 18, 2012 00:16
Show Gist options
  • Save jimjeffers/1629958 to your computer and use it in GitHub Desktop.
Save jimjeffers/1629958 to your computer and use it in GitHub Desktop.
Some of my most used mix-ins for SASS.
@mixin rounded($side, $radius: 10px) {
border-#{$side}-radius: $radius;
-moz-border-radius-#{$side}: $radius;
-webkit-border-#{$side}-radius: $radius;
}
@mixin round($radius: 10px) {
border-radius: $radius;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
}
@mixin shadowed($color, $blur: 0, $x: 0, $y: 0) {
-o-box-shadow: $x $y $blur $color;
-icab-box-shadow: $x $y $blur $color;
-khtml-box-shadow: $x $y $blur $color;
-ms-box-shadow: $x $y $blur $color;
-moz-box-shadow: $x $y $blur $color;
-webkit-box-shadow: $x $y $blur $color;
box-shadow: $x $y $blur $color;
}
@mixin inset-shadowed($color, $blur: 0, $x: 0, $y: 0) {
-o-box-shadow: inset $x $y $blur $color;
-icab-box-shadow: inset $x $y $blur $color;
-khtml-box-shadow: inset $x $y $blur $color;
-ms-box-shadow: inset $x $y $blur $color;
-moz-box-shadow: inset $x $y $blur $color;
-webkit-box-shadow: inset $x $y $blur $color;
box-shadow: inset $x $y $blur $color;
}
@mixin transitioned($property: all, $time: 0.5s, $ease: ease-in-out) {
-moz-transition: $property $ease $ease;
-ms-transition: $property $ease $ease;
-o-transition: $property $ease $ease;
-webkit-transition: $property $time $ease;
transition: $property $time $ease;
}
@mixin rotate($degrees: 0deg){
-moz-transform: rotate($degrees);
-ms-transform: rotate($degrees);
-o-transform: rotate($degrees);
-webkit-transform: rotate($degrees);
transform: rotate($degrees);
}
@mixin scale($amount: 0){
-moz-transform: scale($amount);
-ms-transform: scale($amount);
-o-transform: scale($amount);
-webkit-transform: scale($amount);
transform: scale($amount);
}
@mixin translate($x: 0, $y: 0){
-moz-transform: translate($x,$y);
-ms-transform: translate($x,$y);
-o-transform: translate($x,$y);
-webkit-transform: translate($x,$y);
transform: translate($x,$y);
}
@mixin transform($x: 0, $y: 0, $amount: 0, $degrees: 0deg){
-moz-transform: translate($x,$y) rotate($degrees) scale($amount);
-ms-transform: translate($x,$y) rotate($degrees) scale($amount);
-o-transform: translate($x,$y) rotate($degrees) scale($amount);
-webkit-transform: translate($x,$y) rotate($degrees) scale($amount);
transform: translate($x,$y) rotate($degrees) scale($amount);
}
@mixin transform-origin($x: 0, $y: 0){
-moz-transform-origin: $x $y;
-ms-transform-origin: $x $y;
-o-transform-origin: $x $y;
-webkit-transform-origin: $x $y;
transform-origin: $x $y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment