info@53: // info@53: // Mixins info@53: // -------------------------------------------------- info@53: info@53: info@53: // Utilities info@53: // ------------------------- info@53: info@53: // Clearfix info@53: // Source: http://nicolasgallagher.com/micro-clearfix-hack/ info@53: // info@53: // For modern browsers info@53: // 1. The space content is one way to avoid an Opera bug when the info@53: // contenteditable attribute is included anywhere else in the document. info@53: // Otherwise it causes space to appear at the top and bottom of elements info@53: // that are clearfixed. info@53: // 2. The use of `table` rather than `block` is only necessary if using info@53: // `:before` to contain the top-margins of child elements. info@53: .clearfix() { info@53: &:before, info@53: &:after { info@53: content: " "; // 1 info@53: display: table; // 2 info@53: } info@53: &:after { info@53: clear: both; info@53: } info@53: } info@53: info@53: // WebKit-style focus info@53: .tab-focus() { info@53: // Default info@53: outline: thin dotted; info@53: // WebKit info@53: outline: 5px auto -webkit-focus-ring-color; info@53: outline-offset: -2px; info@53: } info@53: info@53: // Center-align a block level element info@53: .center-block() { info@53: display: block; info@53: margin-left: auto; info@53: margin-right: auto; info@53: } info@53: info@53: // Sizing shortcuts info@53: .size(@width; @height) { info@53: width: @width; info@53: height: @height; info@53: } info@53: .square(@size) { info@53: .size(@size; @size); info@53: } info@53: info@53: // Placeholder text info@53: .placeholder(@color: @input-color-placeholder) { info@53: &:-moz-placeholder { color: @color; } // Firefox 4-18 info@53: &::-moz-placeholder { color: @color; // Firefox 19+ info@53: opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526 info@53: &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+ info@53: &::-webkit-input-placeholder { color: @color; } // Safari and Chrome info@53: } info@53: info@53: // Text overflow info@53: // Requires inline-block or block for proper styling info@53: .text-overflow() { info@53: overflow: hidden; info@53: text-overflow: ellipsis; info@53: white-space: nowrap; info@53: } info@53: info@53: // CSS image replacement info@53: // info@53: // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for info@53: // mixins being reused as classes with the same name, this doesn't hold up. As info@53: // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note info@53: // that we cannot chain the mixins together in Less, so they are repeated. info@53: // info@53: // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 info@53: info@53: // Deprecated as of v3.0.1 (will be removed in v4) info@53: .hide-text() { info@53: font: ~"0/0" a; info@53: color: transparent; info@53: text-shadow: none; info@53: background-color: transparent; info@53: border: 0; info@53: } info@53: // New mixin to use as of v3.0.1 info@53: .text-hide() { info@53: .hide-text(); info@53: } info@53: info@53: info@53: info@53: // CSS3 PROPERTIES info@53: // -------------------------------------------------- info@53: info@53: // Single side border-radius info@53: .border-top-radius(@radius) { info@53: border-top-right-radius: @radius; info@53: border-top-left-radius: @radius; info@53: } info@53: .border-right-radius(@radius) { info@53: border-bottom-right-radius: @radius; info@53: border-top-right-radius: @radius; info@53: } info@53: .border-bottom-radius(@radius) { info@53: border-bottom-right-radius: @radius; info@53: border-bottom-left-radius: @radius; info@53: } info@53: .border-left-radius(@radius) { info@53: border-bottom-left-radius: @radius; info@53: border-top-left-radius: @radius; info@53: } info@53: info@53: // Drop shadows info@53: .box-shadow(@shadow) { info@53: -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1 info@53: box-shadow: @shadow; info@53: } info@53: info@53: // Transitions info@53: .transition(@transition) { info@53: -webkit-transition: @transition; info@53: transition: @transition; info@53: } info@53: .transition-property(@transition-property) { info@53: -webkit-transition-property: @transition-property; info@53: transition-property: @transition-property; info@53: } info@53: .transition-delay(@transition-delay) { info@53: -webkit-transition-delay: @transition-delay; info@53: transition-delay: @transition-delay; info@53: } info@53: .transition-duration(@transition-duration) { info@53: -webkit-transition-duration: @transition-duration; info@53: transition-duration: @transition-duration; info@53: } info@53: .transition-transform(@transition) { info@53: -webkit-transition: -webkit-transform @transition; info@53: -moz-transition: -moz-transform @transition; info@53: -o-transition: -o-transform @transition; info@53: transition: transform @transition; info@53: } info@53: info@53: // Transformations info@53: .rotate(@degrees) { info@53: -webkit-transform: rotate(@degrees); info@53: -ms-transform: rotate(@degrees); // IE9+ info@53: transform: rotate(@degrees); info@53: } info@53: .scale(@ratio) { info@53: -webkit-transform: scale(@ratio); info@53: -ms-transform: scale(@ratio); // IE9+ info@53: transform: scale(@ratio); info@53: } info@53: .translate(@x; @y) { info@53: -webkit-transform: translate(@x, @y); info@53: -ms-transform: translate(@x, @y); // IE9+ info@53: transform: translate(@x, @y); info@53: } info@53: .skew(@x; @y) { info@53: -webkit-transform: skew(@x, @y); info@53: -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+ info@53: transform: skew(@x, @y); info@53: } info@53: .translate3d(@x; @y; @z) { info@53: -webkit-transform: translate3d(@x, @y, @z); info@53: transform: translate3d(@x, @y, @z); info@53: } info@53: info@53: .rotateX(@degrees) { info@53: -webkit-transform: rotateX(@degrees); info@53: -ms-transform: rotateX(@degrees); // IE9+ info@53: transform: rotateX(@degrees); info@53: } info@53: .rotateY(@degrees) { info@53: -webkit-transform: rotateY(@degrees); info@53: -ms-transform: rotateY(@degrees); // IE9+ info@53: transform: rotateY(@degrees); info@53: } info@53: .perspective(@perspective) { info@53: -webkit-perspective: @perspective; info@53: -moz-perspective: @perspective; info@53: perspective: @perspective; info@53: } info@53: .perspective-origin(@perspective) { info@53: -webkit-perspective-origin: @perspective; info@53: -moz-perspective-origin: @perspective; info@53: perspective-origin: @perspective; info@53: } info@53: .transform-origin(@origin) { info@53: -webkit-transform-origin: @origin; info@53: -moz-transform-origin: @origin; info@53: transform-origin: @origin; info@53: } info@53: info@53: // Animations info@53: .animation(@animation) { info@53: -webkit-animation: @animation; info@53: animation: @animation; info@53: } info@53: info@53: // Backface visibility info@53: // Prevent browsers from flickering when using CSS 3D transforms. info@53: // Default value is `visible`, but can be changed to `hidden` info@53: .backface-visibility(@visibility){ info@53: -webkit-backface-visibility: @visibility; info@53: -moz-backface-visibility: @visibility; info@53: backface-visibility: @visibility; info@53: } info@53: info@53: // Box sizing info@53: .box-sizing(@boxmodel) { info@53: -webkit-box-sizing: @boxmodel; info@53: -moz-box-sizing: @boxmodel; info@53: box-sizing: @boxmodel; info@53: } info@53: info@53: // User select info@53: // For selecting text on the page info@53: .user-select(@select) { info@53: -webkit-user-select: @select; info@53: -moz-user-select: @select; info@53: -ms-user-select: @select; // IE10+ info@53: -o-user-select: @select; info@53: user-select: @select; info@53: } info@53: info@53: // Resize anything info@53: .resizable(@direction) { info@53: resize: @direction; // Options: horizontal, vertical, both info@53: overflow: auto; // Safari fix info@53: } info@53: info@53: // CSS3 Content Columns info@53: .content-columns(@column-count; @column-gap: @grid-gutter-width) { info@53: -webkit-column-count: @column-count; info@53: -moz-column-count: @column-count; info@53: column-count: @column-count; info@53: -webkit-column-gap: @column-gap; info@53: -moz-column-gap: @column-gap; info@53: column-gap: @column-gap; info@53: } info@53: info@53: // Optional hyphenation info@53: .hyphens(@mode: auto) { info@53: word-wrap: break-word; info@53: -webkit-hyphens: @mode; info@53: -moz-hyphens: @mode; info@53: -ms-hyphens: @mode; // IE10+ info@53: -o-hyphens: @mode; info@53: hyphens: @mode; info@53: } info@53: info@53: // Opacity info@53: .opacity(@opacity) { info@53: opacity: @opacity; info@53: // IE8 filter info@53: @opacity-ie: (@opacity * 100); info@53: filter: ~"alpha(opacity=@{opacity-ie})"; info@53: } info@53: info@53: info@53: info@53: // GRADIENTS info@53: // -------------------------------------------------- info@53: info@53: #gradient { info@53: info@53: // Horizontal gradient, from left to right info@53: // info@53: // Creates two color stops, start and end, by specifying a color and position for each color stop. info@53: // Color stops are not available in IE9 and below. info@53: .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) { info@53: background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1-6, Chrome 10+ info@53: background-image: linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+ info@53: background-repeat: repeat-x; info@53: filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down info@53: } info@53: info@53: // Vertical gradient, from top to bottom info@53: // info@53: // Creates two color stops, start and end, by specifying a color and position for each color stop. info@53: // Color stops are not available in IE9 and below. info@53: .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) { info@53: background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // Safari 5.1-6, Chrome 10+ info@53: background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+ info@53: background-repeat: repeat-x; info@53: filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down info@53: } info@53: info@53: .directional(@start-color: #555; @end-color: #333; @deg: 45deg) { info@53: background-repeat: repeat-x; info@53: background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+ info@53: background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+ info@53: } info@53: .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) { info@53: background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color); info@53: background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color); info@53: background-repeat: no-repeat; info@53: filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback info@53: } info@53: .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) { info@53: background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color); info@53: background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color); info@53: background-repeat: no-repeat; info@53: filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback info@53: } info@53: .radial(@inner-color: #555; @outer-color: #333) { info@53: background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color); info@53: background-image: radial-gradient(circle, @inner-color, @outer-color); info@53: background-repeat: no-repeat; info@53: } info@53: .striped(@color: rgba(255,255,255,.15); @angle: 45deg) { info@53: background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent); info@53: background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent); info@53: } info@53: } info@53: info@53: // Reset filters for IE info@53: // info@53: // When you need to remove a gradient background, do not forget to use this to reset info@53: // the IE filter for IE9 and below. info@53: .reset-filter() { info@53: filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); info@53: } info@53: info@53: info@53: info@53: // Retina images info@53: // info@53: // Short retina mixin for setting background-image and -size info@53: info@53: .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { info@53: background-image: url("@{file-1x}"); info@53: info@53: @media info@53: only screen and (-webkit-min-device-pixel-ratio: 2), info@53: only screen and ( min--moz-device-pixel-ratio: 2), info@53: only screen and ( -o-min-device-pixel-ratio: 2/1), info@53: only screen and ( min-device-pixel-ratio: 2), info@53: only screen and ( min-resolution: 192dpi), info@53: only screen and ( min-resolution: 2dppx) { info@53: background-image: url("@{file-2x}"); info@53: background-size: @width-1x @height-1x; info@53: } info@53: } info@53: info@53: info@53: // Responsive image info@53: // info@53: // Keep images from scaling beyond the width of their parents. info@53: info@53: .img-responsive(@display: block;) { info@53: display: @display; info@53: max-width: 100%; // Part 1: Set a maximum relative to the parent info@53: height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching info@53: } info@53: info@53: info@53: // COMPONENT MIXINS info@53: // -------------------------------------------------- info@53: info@53: // Horizontal dividers info@53: // ------------------------- info@53: // Dividers (basically an hr) within dropdowns and nav lists info@53: .nav-divider(@color: #e5e5e5) { info@53: height: 1px; info@53: margin: ((@line-height-computed / 2) - 1) 0; info@53: overflow: hidden; info@53: background-color: @color; info@53: } info@53: info@53: // Panels info@53: // ------------------------- info@53: .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) { info@53: border-color: @border; info@53: info@53: & > .panel-heading { info@53: color: @heading-text-color; info@53: background-color: @heading-bg-color; info@53: border-color: @heading-border; info@53: info@53: + .panel-collapse .panel-body { info@53: border-top-color: @border; info@53: } info@53: } info@53: & > .panel-footer { info@53: + .panel-collapse .panel-body { info@53: border-bottom-color: @border; info@53: } info@53: } info@53: } info@53: info@53: // Alerts info@53: // ------------------------- info@53: .alert-variant(@background; @border; @text-color) { info@53: background-color: @background; info@53: border-color: @border; info@53: color: @text-color; info@53: info@53: hr { info@53: border-top-color: darken(@border, 5%); info@53: } info@53: .alert-link { info@53: color: darken(@text-color, 10%); info@53: } info@53: } info@53: info@53: // Tables info@53: // ------------------------- info@53: .table-row-variant(@state; @background) { info@53: // Exact selectors below required to override `.table-striped` and prevent info@53: // inheritance to nested tables. info@53: .table { info@53: > thead, info@53: > tbody, info@53: > tfoot { info@53: > tr > .@{state}, info@53: > .@{state} > td, info@53: > .@{state} > th { info@53: background-color: @background; info@53: } info@53: } info@53: } info@53: info@53: // Hover states for `.table-hover` info@53: // Note: this is not available for cells or rows within `thead` or `tfoot`. info@53: .table-hover > tbody { info@53: > tr > .@{state}:hover, info@53: > .@{state}:hover > td, info@53: > .@{state}:hover > th { info@53: background-color: darken(@background, 5%); info@53: } info@53: } info@53: } info@53: info@53: // Button variants info@53: // ------------------------- info@53: // Easily pump out default styles, as well as :hover, :focus, :active, info@53: // and disabled options for all buttons info@53: .button-variant(@color; @background; @border) { info@53: color: @color; info@53: background-color: @background; info@53: border-color: @border; info@53: info@53: &:hover, info@53: &:focus, info@53: &:active, info@53: &.active, info@53: .open .dropdown-toggle& { info@53: color: @color; info@53: background-color: darken(@background, 8%); info@53: border-color: darken(@border, 12%); info@53: } info@53: &:active, info@53: &.active, info@53: .open .dropdown-toggle& { info@53: background-image: none; info@53: } info@53: &.disabled, info@53: &[disabled], info@53: fieldset[disabled] & { info@53: &, info@53: &:hover, info@53: &:focus, info@53: &:active, info@53: &.active { info@53: background-color: @background; info@53: border-color: @border; info@53: } info@53: } info@53: info@53: .badge { info@53: color: @background; info@53: background-color: #fff; info@53: } info@53: } info@53: info@53: // Button sizes info@53: // ------------------------- info@53: .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { info@53: padding: @padding-vertical @padding-horizontal; info@53: font-size: @font-size; info@53: line-height: @line-height; info@53: border-radius: @border-radius; info@53: } info@53: info@53: // Pagination info@53: // ------------------------- info@53: .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) { info@53: > li { info@53: > a, info@53: > span { info@53: padding: @padding-vertical @padding-horizontal; info@53: font-size: @font-size; info@53: } info@53: &:first-child { info@53: > a, info@53: > span { info@53: .border-left-radius(@border-radius); info@53: } info@53: } info@53: &:last-child { info@53: > a, info@53: > span { info@53: .border-right-radius(@border-radius); info@53: } info@53: } info@53: } info@53: } info@53: info@53: // Labels info@53: // ------------------------- info@53: .label-variant(@color) { info@53: background-color: @color; info@53: &[href] { info@53: &:hover, info@53: &:focus { info@53: background-color: darken(@color, 10%); info@53: } info@53: } info@53: } info@53: info@53: // Navbar vertical align info@53: // ------------------------- info@53: // Vertically center elements in the navbar. info@53: // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. info@53: .navbar-vertical-align(@element-height) { info@53: margin-top: ((@navbar-height - @element-height) / 2); info@53: margin-bottom: ((@navbar-height - @element-height) / 2); info@53: } info@53: info@53: // Progress bars info@53: // ------------------------- info@53: .progress-bar-variant(@color) { info@53: background-color: @color; info@53: .progress-striped & { info@53: #gradient > .striped(); info@53: } info@53: } info@53: info@53: // Responsive utilities info@53: // ------------------------- info@53: // More easily include all the states for responsive-utilities.less. info@53: .responsive-visibility() { info@53: display: block !important; info@53: table& { display: table; } info@53: tr& { display: table-row !important; } info@53: th&, info@53: td& { display: table-cell !important; } info@53: } info@53: info@53: .responsive-invisibility() { info@53: &, info@53: tr&, info@53: th&, info@53: td& { display: none !important; } info@53: } info@53: info@53: info@53: // Grid System info@53: // ----------- info@53: info@53: // Centered container element info@53: .container-fixed() { info@53: margin-right: auto; info@53: margin-left: auto; info@53: padding-left: (@grid-gutter-width / 2); info@53: padding-right: (@grid-gutter-width / 2); info@53: .clearfix(); info@53: } info@53: info@53: // Creates a wrapper for a series of columns info@53: .make-row(@gutter: @grid-gutter-width) { info@53: margin-left: (@gutter / -2); info@53: margin-right: (@gutter / -2); info@53: .clearfix(); info@53: } info@53: info@53: // Generate the extra small columns info@53: .make-xs-column(@columns; @gutter: @grid-gutter-width) { info@53: position: relative; info@53: float: left; info@53: width: percentage((@columns / @grid-columns)); info@53: // Prevent columns from collapsing when empty info@53: min-height: 1px; info@53: // Inner gutter via padding info@53: padding-left: (@gutter / 2); info@53: padding-right: (@gutter / 2); info@53: } info@53: info@53: // Generate the small columns info@53: .make-sm-column(@columns; @gutter: @grid-gutter-width) { info@53: position: relative; info@53: // Prevent columns from collapsing when empty info@53: min-height: 1px; info@53: // Inner gutter via padding info@53: padding-left: (@gutter / 2); info@53: padding-right: (@gutter / 2); info@53: info@53: // Calculate width based on number of columns available info@53: @media (min-width: @screen-sm-min) { info@53: float: left; info@53: width: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: // Generate the small column offsets info@53: .make-sm-column-offset(@columns) { info@53: @media (min-width: @screen-sm-min) { info@53: margin-left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-sm-column-push(@columns) { info@53: @media (min-width: @screen-sm-min) { info@53: left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-sm-column-pull(@columns) { info@53: @media (min-width: @screen-sm-min) { info@53: right: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: // Generate the medium columns info@53: .make-md-column(@columns; @gutter: @grid-gutter-width) { info@53: position: relative; info@53: // Prevent columns from collapsing when empty info@53: min-height: 1px; info@53: // Inner gutter via padding info@53: padding-left: (@gutter / 2); info@53: padding-right: (@gutter / 2); info@53: info@53: // Calculate width based on number of columns available info@53: @media (min-width: @screen-md-min) { info@53: float: left; info@53: width: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: // Generate the medium column offsets info@53: .make-md-column-offset(@columns) { info@53: @media (min-width: @screen-md-min) { info@53: margin-left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-md-column-push(@columns) { info@53: @media (min-width: @screen-md) { info@53: left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-md-column-pull(@columns) { info@53: @media (min-width: @screen-md-min) { info@53: right: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: // Generate the large columns info@53: .make-lg-column(@columns; @gutter: @grid-gutter-width) { info@53: position: relative; info@53: // Prevent columns from collapsing when empty info@53: min-height: 1px; info@53: // Inner gutter via padding info@53: padding-left: (@gutter / 2); info@53: padding-right: (@gutter / 2); info@53: info@53: // Calculate width based on number of columns available info@53: @media (min-width: @screen-lg-min) { info@53: float: left; info@53: width: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: // Generate the large column offsets info@53: .make-lg-column-offset(@columns) { info@53: @media (min-width: @screen-lg-min) { info@53: margin-left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-lg-column-push(@columns) { info@53: @media (min-width: @screen-lg-min) { info@53: left: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: .make-lg-column-pull(@columns) { info@53: @media (min-width: @screen-lg-min) { info@53: right: percentage((@columns / @grid-columns)); info@53: } info@53: } info@53: info@53: info@53: // Framework grid generation info@53: // info@53: // Used only by Bootstrap to generate the correct number of grid classes given info@53: // any value of `@grid-columns`. info@53: info@53: .make-grid-columns() { info@53: // Common styles for all sizes of grid columns, widths 1-12 info@53: .col(@index) when (@index = 1) { // initial info@53: @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}"; info@53: .col(@index + 1, @item); info@53: } info@53: .col(@index, @list) when (@index =< @grid-columns) { // general; "=<" isn't a typo info@53: @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}"; info@53: .col(@index + 1, ~"@{list}, @{item}"); info@53: } info@53: .col(@index, @list) when (@index > @grid-columns) { // terminal info@53: @{list} { info@53: position: relative; info@53: // Prevent columns from collapsing when empty info@53: min-height: 1px; info@53: // Inner gutter via padding info@53: padding-left: (@grid-gutter-width / 2); info@53: padding-right: (@grid-gutter-width / 2); info@53: } info@53: } info@53: .col(1); // kickstart it info@53: } info@53: info@53: .make-grid-columns-float(@class) { info@53: .col(@index) when (@index = 1) { // initial info@53: @item: ~".col-@{class}-@{index}"; info@53: .col(@index + 1, @item); info@53: } info@53: .col(@index, @list) when (@index =< @grid-columns) { // general info@53: @item: ~".col-@{class}-@{index}"; info@53: .col(@index + 1, ~"@{list}, @{item}"); info@53: } info@53: .col(@index, @list) when (@index > @grid-columns) { // terminal info@53: @{list} { info@53: float: left; info@53: } info@53: } info@53: .col(1); // kickstart it info@53: } info@53: info@53: .calc-grid(@index, @class, @type) when (@type = width) and (@index > 0) { info@53: .col-@{class}-@{index} { info@53: width: percentage((@index / @grid-columns)); info@53: } info@53: } info@53: .calc-grid(@index, @class, @type) when (@type = push) { info@53: .col-@{class}-push-@{index} { info@53: left: percentage((@index / @grid-columns)); info@53: } info@53: } info@53: .calc-grid(@index, @class, @type) when (@type = pull) { info@53: .col-@{class}-pull-@{index} { info@53: right: percentage((@index / @grid-columns)); info@53: } info@53: } info@53: .calc-grid(@index, @class, @type) when (@type = offset) { info@53: .col-@{class}-offset-@{index} { info@53: margin-left: percentage((@index / @grid-columns)); info@53: } info@53: } info@53: info@53: // Basic looping in LESS info@53: .make-grid(@index, @class, @type) when (@index >= 0) { info@53: .calc-grid(@index, @class, @type); info@53: // next iteration info@53: .make-grid(@index - 1, @class, @type); info@53: } info@53: info@53: info@53: // Form validation states info@53: // info@53: // Used in forms.less to generate the form validation CSS for warnings, errors, info@53: // and successes. info@53: info@53: .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) { info@53: // Color the label and help text info@53: .help-block, info@53: .control-label, info@53: .radio, info@53: .checkbox, info@53: .radio-inline, info@53: .checkbox-inline { info@53: color: @text-color; info@53: } info@53: // Set the border and box shadow on specific inputs to match info@53: .form-control { info@53: border-color: @border-color; info@53: .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work info@53: &:focus { info@53: border-color: darken(@border-color, 10%); info@53: @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%); info@53: .box-shadow(@shadow); info@53: } info@53: } info@53: // Set validation states also for addons info@53: .input-group-addon { info@53: color: @text-color; info@53: border-color: @border-color; info@53: background-color: @background-color; info@53: } info@53: } info@53: info@53: // Form control focus state info@53: // info@53: // Generate a customized focus state and for any input with the specified color, info@53: // which defaults to the `@input-focus-border` variable. info@53: // info@53: // We highly encourage you to not customize the default value, but instead use info@53: // this to tweak colors on an as-needed basis. This aesthetic change is based on info@53: // WebKit's default styles, but applicable to a wider range of browsers. Its info@53: // usability and accessibility should be taken into account with any change. info@53: // info@53: // Example usage: change the default blue border and shadow to white for better info@53: // contrast against a dark gray background. info@53: info@53: .form-control-focus(@color: @input-border-focus) { info@53: @color-rgba: rgba(red(@color), green(@color), blue(@color), .6); info@53: &:focus { info@53: border-color: @color; info@53: outline: 0; info@53: .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}"); info@53: } info@53: } info@53: info@53: // Form control sizing info@53: // info@53: // Relative text size, padding, and border-radii changes for form controls. For info@53: // horizontal sizing, wrap controls in the predefined grid classes. `