Last active
October 20, 2015 14:49
-
-
Save kirpalmakanga/6924b31ef64cbea1380f to your computer and use it in GitHub Desktop.
Useful SCSS Mixins
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
//////* Transition *////// | |
@mixin transition($property: all, $duration: 0.5s, $easing: ease-out) { | |
transition: $property $duration $easing; | |
} | |
@mixin delay($duration: 0.5s) { | |
transition-delay: $duration; | |
} | |
//////* Transforms *////// | |
/* translate */ | |
@mixin translate($x-axis, $y-axis) { | |
transform: translate($x-axis,$y-axis); | |
} | |
/* translateX */ | |
@mixin translateX($position) { | |
transform: translateX($position); | |
} | |
/* translateY */ | |
@mixin translateY($position) { | |
transform: translateY($position); | |
} | |
/* rotate */ | |
@mixin rotate($angle) { | |
transform: rotate($angle); | |
} | |
/* scale */ | |
@mixin scale($ratio) { | |
transform: scale($ratio); | |
} | |
/* Shapes */ | |
/* rectangle */ | |
@mixin rectangle($width, $height) { | |
width: $width; | |
height: $height; | |
} | |
/* square */ | |
@mixin square($width) { | |
.rectangle($width, $width); | |
} | |
/* circle */ | |
@mixin circle($diameter) { | |
.square($diameter); | |
border-radius: 100%; | |
} | |
//////* Fonts *////// | |
@mixin font-face($font-family, $file-path, $font-weight, $font-style) { | |
@font-face { | |
font-family: $font-family; | |
src: url('#{$file-path}.eot'); | |
src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'), | |
url('#{$file-path}.woff') format('woff'), | |
url('#{$file-path}.woff2') format('woff2'), | |
url('#{$file-path}.ttf') format('truetype'); | |
font-weight: $font-weight; | |
font-style: $font-style; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment