/* Mixins.scss * Snippets of reusable CSS to develop faster and keep code readable * ----------------------------------------------------------------- */ // Clearfix for clearing floats like a boss h5bp.com/q @mixin clearfix { zoom: 1; &:before, &:after { display: table; content: ""; } &:after { clear: both; } } // Center-align a block level element @mixin center-block { display: block; margin: 0 auto; } // Sizing shortcuts @mixin size($height: 5px, $width: 5px) { height: $height; width: $width; } @mixin square($size: 5px) { @include size($size, $size); } // Input placeholder text @mixin placeholder($color: $grayLight) { :-moz-placeholder { color: $color; } ::-webkit-input-placeholder { color: $color; } } // Font Stacks @mixin shorthand($weight: normal, $size: 14px, $lineHeight: 20px) { font-size: $size; font-weight: $weight; line-height: $lineHeight; } @mixin sans-serif($weight: normal, $size: 14px, $lineHeight: 20px) { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: $size; font-weight: $weight; line-height: $lineHeight; } @mixin serif($weight: normal, $size: 14px, $lineHeight: 20px) { font-family: "Georgia", Times New Roman, Times, serif; font-size: $size; font-weight: $weight; line-height: $lineHeight; } @mixin monospace($weight: normal, $size: 12px, $lineHeight: 20px) { font-family: "Monaco", Courier New, monospace; font-size: $size; font-weight: $weight; line-height: $lineHeight; } // Grid System @mixin fixed-container() { width: $siteWidth; margin-left: auto; margin-right: auto; @include clearfix(); } @mixin columns($columnSpan: 1) { width: ($gridColumnWidth * $columnSpan) + ($gridGutterWidth * ($columnSpan - 1)); } @mixin offset($columnOffset: 1) { margin-left: ($gridColumnWidth * $columnOffset) + ($gridGutterWidth * ($columnOffset - 1)) + $extraSpace; } // Necessary grid styles for every column to make them appear next to each other horizontally @mixin gridColumn() { display: inline; float: left; margin-left: $gridGutterWidth; } // makeColumn can be used to mark any element (e.g., .content-primary) as a column without changing markup to .span something @mixin makeColumn($columnSpan: 1) { @include gridColumn(); @include columns($columnSpan); } // Border Radius (Will use compass version) // Drop shadows (Will use compass version) // Transitions @mixin transition($transition) { -webkit-transition: $transition; -moz-transition: $transition; -ms-transition: $transition; -o-transition: $transition; transition: $transition; } // Background clipping @mixin background-clip($clip) { -webkit-background-clip: $clip; -moz-background-clip: $clip; background-clip: $clip; } // CSS3 Content Columns @mixin content-columns($columnCount, $columnGap: 20px) { -webkit-column-count: $columnCount; -moz-column-count: $columnCount; column-count: $columnCount; -webkit-column-gap: $columnGap; -moz-column-gap: $columnGap; column-gap: $columnGap; } // Add an alphatransparency value to any background or border color (via Elyse Holladay) @mixin translucent-background($color: $white, $alpha: 1) { background-color: hsla(hue($color), saturation($color), lightness($color), $alpha); } @mixin translucent-border($color: $white, $alpha: 1) { border-color: hsla(hue($color), saturation($color), lightness($color), $alpha); background-clip: padding-box; } // Gradients @mixin gradient-horizontal($startColor: #555, $endColor: #333) { background-color: $endColor; background-repeat: repeat-x; @include filter-gradient($startColor, $endColor, horizontal); background-image: -khtml-gradient(linear, left top, right top, from($startColor), to($endColor)); // Konqueror @include background-image(linear-gradient(left, $startColor, $endColor)); } @mixin gradient-vertical ($startColor: #555, $endColor: #333) { background-color: $endColor; background-repeat: repeat-x; @include filter-gradient($startColor, $endColor); background-image: -khtml-gradient(linear, left top, left bottom, from($startColor), to($endColor)); // Konqueror @include background-image(linear-gradient($startColor, $endColor)); } @mixin gradient-directional ($startColor: #555, $endColor: #333, $deg: 45deg) { background-color: $endColor; background-repeat: repeat-x; @include background-image(linear-gradient(left top, $startColor, $endColor)); } @mixin gradient-vertical-three-colors($startColor: #00b3ee, $midColor: #7a43b6, $colorStop: 50%, $endColor: #c3325f) { background-color: $endColor; background-repeat: no-repeat; @include filter-gradient($startColor, $endColor); @include background-image(linear-gradient($startColor, $midColor $colorStop, $endColor)); } // Gradient Bar Colors for buttons and allerts @mixin gradientBar($primaryColor, $secondaryColor) { @include gradient-vertical($primaryColor, $secondaryColor); text-shadow: 0 -1px 0 rgba(0,0,0,.25); border-color: $secondaryColor $secondaryColor darken($secondaryColor, 15%); border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%); } // Reset filters for IE @mixin reset-filter() { -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)"; } // Opacity (Will use compass version)