/*------------------------------------*\ $MIXINS \*------------------------------------*/ /** * MIXINS COLLECTION * * Designed and built @kurenn */ //Clears the float from any element @mixin clearfix { *zoom: 1; &:before, &:after { display: table; content: ""; } &:after { clear: both; } } @mixin inline-block { display: inline-block; zoom: 1; *display: inline; } // FORMS // -------------------------------------------------- // Block level inputs @mixin input-block-level { display: block; width: 100%; min-height: $inputHeight; // Make inputs at least the height of their button counterpart (base line-height + padding + border) @include box-sizing(border-box); // Makes inputs behave like true block-level elements } @mixin dropdown-arrow($color: $select-options-bg, $top: 5px, $left: 15px, $size: 9px) { &:before { content: ''; border-style: solid; border-width: 0 $size $size $size; border-color: transparent transparent $color transparent; height: 0px; position: absolute; left: $left; top: $top; width: 0px; // Make corners smooth -webkit-transform: rotate(360deg); } } @mixin nav-divider($top: #e5e5e5, $bottom: #FFF) { // IE7 needs a set width since we gave a height. Restricting just // to IE7 to keep the 1px left/right space in other browsers. // It is unclear where IE is getting the extra space that we need // to negative-margin away, but so it goes. *width: 100%; height: 1px; margin: (($base-line-height / 2) - 1) 1px; // 8px 1px *margin: -5px 0 5px; overflow: hidden; background-color: $top; border-bottom: 1px solid $bottom; } // Grid System // ----------- // Centered container element @mixin container-fixed() { margin-right: auto; margin-left: auto; @include clearfix(); } // Table columns @mixin tableColumns($columnSpan: 1) { float: none; // undo default grid column styles width: (($gridColumnWidth) * $columnSpan) + ($gridGutterWidth * ($columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells margin-left: 0; // undo default grid column styles } // Make a Grid // Use .makeRow and .makeColumn to assign semantic layouts grid system behavior @mixin makeRow() { margin-left: $gridGutterWidth * -1; @include clearfix(); } @mixin makeColumn($columns: 1, $offset: 0) { float: left; margin-left: ($gridColumnWidth * $offset) + ($gridGutterWidth * ($offset - 1)) + ($gridGutterWidth * 2); width: ($gridColumnWidth * $columns) + ($gridGutterWidth * ($columns - 1)); } // The Grid @mixin grid-core($gridColumnWidth, $gridGutterWidth) { .row { margin-left: $gridGutterWidth * -1; @include clearfix(); } [class*="span"] { float: left; min-height: 1px; // prevent collapsing columns margin-left: $gridGutterWidth; } // generate .spanX and .offsetX @include grid-core-span-x($gridColumns, $gridColumnWidth, $gridGutterWidth); @include grid-core-offset-x($gridColumns, $gridColumnWidth, $gridGutterWidth); } @mixin grid-core-span-x($gridColumns, $gridColumnWidth, $gridGutterWidth) { @for $i from 1 through $gridColumns { .span#{$i} { @include grid-core-span($i, $gridColumnWidth, $gridGutterWidth); } } } @mixin grid-core-offset-x($gridColumns, $gridColumnWidth, $gridGutterWidth) { @for $i from 1 through $gridColumns { .offset#{$i} { @include grid-core-offset($i, $gridColumnWidth, $gridGutterWidth); } } } @mixin grid-core-span($columns, $gridColumnWidth, $gridGutterWidth) { width: ($gridColumnWidth * $columns) + ($gridGutterWidth * ($columns - 1)); } @mixin grid-core-offset($columns, $gridColumnWidth, $gridGutterWidth) { margin-left: ($gridColumnWidth * $columns) + ($gridGutterWidth * ($columns + 1)); } @mixin grid-fluid($fluidGridColumnWidth, $fluidGridGutterWidth) { .row-fluid { width: 100%; @include clearfix(); [class*="span"] { @include input-block-level(); float: left; margin-left: $fluidGridGutterWidth; *margin-left: $fluidGridGutterWidth - (.5 / $gridRowWidth * 100px * 1%); } [class*="span"]:nth-of-type(1) { margin-left: 0px; } [class*="span"]:first-child { margin-left: 0px; } // Space grid-sized controls properly if multiple per line .controls-row [class*="span"] + [class*="span"] { margin-left: $fluidGridGutterWidth; } // generate .spanX and .offsetX @include grid-fluid-span-x($gridColumns, $fluidGridColumnWidth, $fluidGridGutterWidth); @include grid-fluid-offset-x($gridColumns, $fluidGridColumnWidth, $fluidGridGutterWidth); } } @mixin grid-fluid-span-x($gridColumns, $fluidGridColumnWidth, $fluidGridGutterWidth) { @for $i from 1 through $gridColumns { .span#{$i} { @include grid-fluid-span($i, $fluidGridColumnWidth, $fluidGridGutterWidth); } } } @mixin grid-fluid-offset-x($gridColumns, $fluidGridColumnWidth, $fluidGridGutterWidth) { @for $i from 1 through $gridColumns { .offset#{$i} { @include grid-fluid-offset($i, $fluidGridColumnWidth, $fluidGridGutterWidth); } .offset#{$i}:first-child { @include grid-fluid-offset-first-child($i, $fluidGridColumnWidth, $fluidGridGutterWidth); } } } @mixin grid-fluid-span($columns, $fluidGridColumnWidth, $fluidGridGutterWidth) { width: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)); *width: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)) - (.5 / $gridRowWidth * 100px * 1%); } @mixin grid-fluid-offset($columns, $fluidGridColumnWidth, $fluidGridGutterWidth) { margin-left: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)) + ($fluidGridGutterWidth * 2); *margin-left: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)) - (.5 / $gridRowWidth * 100px * 1%) + ($fluidGridGutterWidth * 2) - (.5 / $gridRowWidth * 100px * 1%); } @mixin grid-fluid-offset-first-child($columns, $fluidGridColumnWidth, $fluidGridGutterWidth) { margin-left: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)) + ($fluidGridGutterWidth); *margin-left: ($fluidGridColumnWidth * $columns) + ($fluidGridGutterWidth * ($columns - 1)) - (.5 / $gridRowWidth * 100px * 1%) + $fluidGridGutterWidth - (.5 / $gridRowWidth * 100px * 1%); } @mixin grid-input($gridColumnWidth, $gridGutterWidth) { input, textarea, .uneditable-input { margin-left: 0; // override margin-left from core grid system } // Space grid-sized controls properly if multiple per line .controls-row [class*="span"] + [class*="span"] { margin-left: $gridGutterWidth; } // generate .spanX @include grid-input-span-x($gridColumns, $gridColumnWidth, $gridGutterWidth); } @mixin grid-input-span-x($gridColumns, $gridColumnWidth, $gridGutterWidth) { @for $i from 1 through $gridColumns { input.span#{$i}, textarea.span#{$i}, .uneditable-input.span#{$i} { @include grid-input-span($i, $gridColumnWidth, $gridGutterWidth); } } } @mixin grid-input-span($columns, $gridColumnWidth, $gridGutterWidth) { width: (($gridColumnWidth) * $columns) + ($gridGutterWidth * ($columns - 1)) - 14; } @mixin active-navbar-link-arrow($navbar-height: 40px) { $default-position: -6px; $default-navbar-height: 40px; top: ((($navbar-height - $default-navbar-height) / 5) * -3) + $default-position; } @mixin touch-callout { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: moz-none; -ms-user-select: none; user-select: none; } // Font Awesome Mixins // -------------------------- @mixin icon($icon) { @include icon-FontAwesome(); content: $icon; } @mixin icon-FontAwesome() { font-family: FontAwesome; font-weight: normal; font-style: normal; text-decoration: inherit; -webkit-font-smoothing: antialiased; *margin-right: .3em; // fixes ie7 issues } @mixin icon-stack($width: 2em, $height: 2em, $top-font-size: 1em, $base-font-size: 2em) { .icon-stack { position: relative; display: inline-block; width: $width; height: $height; line-height: $width; vertical-align: -35%; [class^="icon-"], [class*=" icon-"] { display: block; text-align: center; position: absolute; width: 100%; height: 100%; font-size: $top-font-size; line-height: inherit; *line-height: $height; } .icon-stack-base { font-size: $base-font-size; *line-height: #{$height / $base-font-size}em; } } }