diff options
Diffstat (limited to 'sass/mixins.scss')
-rw-r--r-- | sass/mixins.scss | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/sass/mixins.scss b/sass/mixins.scss new file mode 100644 index 0000000..d7faca8 --- /dev/null +++ b/sass/mixins.scss @@ -0,0 +1,118 @@ +// +// Mixins +// -------------------------------------------------- + + +// General +// -------------------------------------------------- + +// Utilities +// ------------------------- + +// Clearfix +// Source: http://nicolasgallagher.com/micro-clearfix-hack/ +// +// For modern browsers +// 1. The space content is one way to avoid an Opera bug when the +// contenteditable attribute is included anywhere else in the document. +// Otherwise it causes space to appear at the top and bottom of elements +// that are clearfixed. +// 2. The use of `table` rather than `block` is only necessary if using +// `:before` to contain the top-margins of child elements. +@mixin clearfix() { + &:before, + &:after { + content: " "; // 1 + display: table; // 2 + } + &:after { + clear: both; + } +} + +// Box shadow +@mixin box-shadow($shadow...) { + -webkit-box-shadow: $shadow; + box-shadow: $shadow; +} + +// Gradients +@mixin gradient($color-form, $color-to) { + background: $color-form; // Old browsers + background: -moz-linear-gradient(top, $color-form 0%, $color-to 100%); // FF3.6+ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$color-form), color-stop(100%,$color-to)); // Chrome,Safari4+ + background: -webkit-linear-gradient(top, $color-form 0%, $color-to 100%); // Chrome10+,Safari5.1+ + background: -o-linear-gradient(top, $color-form 0%, $color-to 100%); // Opera 11.10+ + background: -ms-linear-gradient(top, $color-form 0%, $color-to 100%); // IE10+ + background: linear-gradient(to bottom, $color-form 0%, $color-to 100%); // W3C + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$color-form', endColorstr='$color-to',GradientType=0 ); // IE6-9 + +} + + +// Transforms +// -------------------------------------------------- +@mixin transform($transform...) { + -webkit-transform: $transform; + -ms-transform: $transform; + transform: $transform; +} + + +// Transitions +// -------------------------------------------------- +@mixin transition($transition...) { + -webkit-transition: $transition; + -moz-transition: $transition; + transition: $transition; +} +@mixin transition-property($property...) { + -webkit-transition-property: $property; + -moz-transition-property: $property; + transition-property: $property; +} +@mixin transition-duration($duration...) { + -webkit-transition-duration: $duration; + -moz-transition-duration: $duration; + transition-duration: $duration; +} +@mixin transition-timing-function($function...) { + -webkit-transition-timing-function: $function; + -moz-transition-timing-function: $function; + transition-timing-function: $function; +} + + +// Animations +// -------------------------------------------------- +@mixin animation-name($name) { + -webkit-animation-name: $name; + -moz-animation-name: $name; + animation-name: $name; +} +@mixin animation-duration($duration) { + -webkit-animation-duration: $duration; + -moz-animation-duration: $duration; + animation-duration: $duration; +} +@mixin animation-direction($direction) { + -webkit-animation-direction: $direction; + -moz-animation-direction: $direction; + animation-direction: $direction; +} + + +// Misc +// -------------------------------------------------- +@mixin hairline($type, $color, $offset) { + @if $type == single { + background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='1'><rect fill='#{$color}' x='0' y='0' width='100%' height='0.5'/></svg>"); + background-position: $offset 100%; + + } @else if $type == double { + background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='1'><rect fill='#{$color}' x='0' y='0' width='100%' height='0.5'/></svg>"), + url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='1'><rect fill='#{$color}' x='0' y='0' width='100%' height='0.5'/></svg>"); + background-position: $offset 100%, $offset 0%; + } + background-repeat: no-repeat; +} |