3 // --------------------------------------------------
7 // -------------------------
10 // Source: http://nicolasgallagher.com/micro-clearfix-hack/
12 // For modern browsers
13 // 1. The space content is one way to avoid an Opera bug when the
14 // contenteditable attribute is included anywhere else in the document.
15 // Otherwise it causes space to appear at the top and bottom of elements
16 // that are clearfixed.
17 // 2. The use of `table` rather than `block` is only necessary if using
18 // `:before` to contain the top-margins of child elements.
35 outline: 5px auto -webkit-focus-ring-color;
39 // Center-align a block level element
47 .size(@width; @height) {
56 .placeholder(@color: @input-color-placeholder) {
57 &::-moz-placeholder { color: @color; // Firefox
58 opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526
59 &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+
60 &::-webkit-input-placeholder { color: @color; } // Safari and Chrome
64 // Requires inline-block or block for proper styling
67 text-overflow: ellipsis;
71 // CSS image replacement
73 // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for
74 // mixins being reused as classes with the same name, this doesn't hold up. As
75 // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note
76 // that we cannot chain the mixins together in Less, so they are repeated.
78 // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
80 // Deprecated as of v3.0.1 (will be removed in v4)
85 background-color: transparent;
88 // New mixin to use as of v3.0.1
96 // --------------------------------------------------
98 // Single side border-radius
99 .border-top-radius(@radius) {
100 border-top-right-radius: @radius;
101 border-top-left-radius: @radius;
103 .border-right-radius(@radius) {
104 border-bottom-right-radius: @radius;
105 border-top-right-radius: @radius;
107 .border-bottom-radius(@radius) {
108 border-bottom-right-radius: @radius;
109 border-bottom-left-radius: @radius;
111 .border-left-radius(@radius) {
112 border-bottom-left-radius: @radius;
113 border-top-left-radius: @radius;
118 // Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's
119 // supported browsers that have box shadow capabilities now support the
120 // standard `box-shadow` property.
121 .box-shadow(@shadow) {
122 -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
127 .transition(@transition) {
128 -webkit-transition: @transition;
129 transition: @transition;
131 .transition-property(@transition-property) {
132 -webkit-transition-property: @transition-property;
133 transition-property: @transition-property;
135 .transition-delay(@transition-delay) {
136 -webkit-transition-delay: @transition-delay;
137 transition-delay: @transition-delay;
139 .transition-duration(@transition-duration) {
140 -webkit-transition-duration: @transition-duration;
141 transition-duration: @transition-duration;
143 .transition-transform(@transition) {
144 -webkit-transition: -webkit-transform @transition;
145 -moz-transition: -moz-transform @transition;
146 -o-transition: -o-transform @transition;
147 transition: transform @transition;
152 -webkit-transform: rotate(@degrees);
153 -ms-transform: rotate(@degrees); // IE9 only
154 transform: rotate(@degrees);
156 .scale(@ratio; @ratio-y...) {
157 -webkit-transform: scale(@ratio, @ratio-y);
158 -ms-transform: scale(@ratio, @ratio-y); // IE9 only
159 transform: scale(@ratio, @ratio-y);
162 -webkit-transform: translate(@x, @y);
163 -ms-transform: translate(@x, @y); // IE9 only
164 transform: translate(@x, @y);
167 -webkit-transform: skew(@x, @y);
168 -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+
169 transform: skew(@x, @y);
171 .translate3d(@x; @y; @z) {
172 -webkit-transform: translate3d(@x, @y, @z);
173 transform: translate3d(@x, @y, @z);
177 -webkit-transform: rotateX(@degrees);
178 -ms-transform: rotateX(@degrees); // IE9 only
179 transform: rotateX(@degrees);
182 -webkit-transform: rotateY(@degrees);
183 -ms-transform: rotateY(@degrees); // IE9 only
184 transform: rotateY(@degrees);
186 .perspective(@perspective) {
187 -webkit-perspective: @perspective;
188 -moz-perspective: @perspective;
189 perspective: @perspective;
191 .perspective-origin(@perspective) {
192 -webkit-perspective-origin: @perspective;
193 -moz-perspective-origin: @perspective;
194 perspective-origin: @perspective;
196 .transform-origin(@origin) {
197 -webkit-transform-origin: @origin;
198 -moz-transform-origin: @origin;
199 -ms-transform-origin: @origin; // IE9 only
200 transform-origin: @origin;
204 .animation(@animation) {
205 -webkit-animation: @animation;
206 animation: @animation;
208 .animation-name(@name) {
209 -webkit-animation-name: @name;
210 animation-name: @name;
212 .animation-duration(@duration) {
213 -webkit-animation-duration: @duration;
214 animation-duration: @duration;
216 .animation-timing-function(@timing-function) {
217 -webkit-animation-timing-function: @timing-function;
218 animation-timing-function: @timing-function;
220 .animation-delay(@delay) {
221 -webkit-animation-delay: @delay;
222 animation-delay: @delay;
224 .animation-iteration-count(@iteration-count) {
225 -webkit-animation-iteration-count: @iteration-count;
226 animation-iteration-count: @iteration-count;
228 .animation-direction(@direction) {
229 -webkit-animation-direction: @direction;
230 animation-direction: @direction;
233 // Backface visibility
234 // Prevent browsers from flickering when using CSS 3D transforms.
235 // Default value is `visible`, but can be changed to `hidden`
236 .backface-visibility(@visibility){
237 -webkit-backface-visibility: @visibility;
238 -moz-backface-visibility: @visibility;
239 backface-visibility: @visibility;
243 .box-sizing(@boxmodel) {
244 -webkit-box-sizing: @boxmodel;
245 -moz-box-sizing: @boxmodel;
246 box-sizing: @boxmodel;
250 // For selecting text on the page
251 .user-select(@select) {
252 -webkit-user-select: @select;
253 -moz-user-select: @select;
254 -ms-user-select: @select; // IE10+
255 user-select: @select;
259 .resizable(@direction) {
260 resize: @direction; // Options: horizontal, vertical, both
261 overflow: auto; // Safari fix
264 // CSS3 Content Columns
265 .content-columns(@column-count; @column-gap: @grid-gutter-width) {
266 -webkit-column-count: @column-count;
267 -moz-column-count: @column-count;
268 column-count: @column-count;
269 -webkit-column-gap: @column-gap;
270 -moz-column-gap: @column-gap;
271 column-gap: @column-gap;
274 // Optional hyphenation
275 .hyphens(@mode: auto) {
276 word-wrap: break-word;
277 -webkit-hyphens: @mode;
279 -ms-hyphens: @mode; // IE10+
288 @opacity-ie: (@opacity * 100);
289 filter: ~"alpha(opacity=@{opacity-ie})";
295 // --------------------------------------------------
299 // Horizontal gradient, from left to right
301 // Creates two color stops, start and end, by specifying a color and position for each color stop.
302 // Color stops are not available in IE9 and below.
303 .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
304 background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1-6, Chrome 10+
305 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+
306 background-repeat: repeat-x;
307 filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down
310 // Vertical gradient, from top to bottom
312 // Creates two color stops, start and end, by specifying a color and position for each color stop.
313 // Color stops are not available in IE9 and below.
314 .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
315 background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // Safari 5.1-6, Chrome 10+
316 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+
317 background-repeat: repeat-x;
318 filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down
321 .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {
322 background-repeat: repeat-x;
323 background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+
324 background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
326 .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
327 background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);
328 background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);
329 background-repeat: no-repeat;
330 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
332 .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
333 background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);
334 background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);
335 background-repeat: no-repeat;
336 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
338 .radial(@inner-color: #555; @outer-color: #333) {
339 background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);
340 background-image: radial-gradient(circle, @inner-color, @outer-color);
341 background-repeat: no-repeat;
343 .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {
344 background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);
345 background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);
349 // Reset filters for IE
351 // When you need to remove a gradient background, do not forget to use this to reset
352 // the IE filter for IE9 and below.
354 filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
361 // Short retina mixin for setting background-image and -size
363 .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
364 background-image: url("@{file-1x}");
367 only screen and (-webkit-min-device-pixel-ratio: 2),
368 only screen and ( min--moz-device-pixel-ratio: 2),
369 only screen and ( -o-min-device-pixel-ratio: 2/1),
370 only screen and ( min-device-pixel-ratio: 2),
371 only screen and ( min-resolution: 192dpi),
372 only screen and ( min-resolution: 2dppx) {
373 background-image: url("@{file-2x}");
374 background-size: @width-1x @height-1x;
381 // Keep images from scaling beyond the width of their parents.
383 .img-responsive(@display: block) {
385 max-width: 100%; // Part 1: Set a maximum relative to the parent
386 height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
391 // --------------------------------------------------
393 // Horizontal dividers
394 // -------------------------
395 // Dividers (basically an hr) within dropdowns and nav lists
396 .nav-divider(@color: #e5e5e5) {
398 margin: ((@line-height-computed / 2) - 1) 0;
400 background-color: @color;
404 // -------------------------
405 .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
406 border-color: @border;
409 color: @heading-text-color;
410 background-color: @heading-bg-color;
411 border-color: @heading-border;
413 + .panel-collapse .panel-body {
414 border-top-color: @border;
418 + .panel-collapse .panel-body {
419 border-bottom-color: @border;
425 // -------------------------
426 .alert-variant(@background; @border; @text-color) {
427 background-color: @background;
428 border-color: @border;
432 border-top-color: darken(@border, 5%);
435 color: darken(@text-color, 10%);
440 // -------------------------
441 .table-row-variant(@state; @background) {
442 // Exact selectors below required to override `.table-striped` and prevent
443 // inheritance to nested tables.
446 .table > tfoot > tr {
451 background-color: @background;
455 // Hover states for `.table-hover`
456 // Note: this is not available for cells or rows within `thead` or `tfoot`.
457 .table-hover > tbody > tr {
460 &.@{state}:hover > td,
461 &.@{state}:hover > th {
462 background-color: darken(@background, 5%);
468 // -------------------------
469 .list-group-item-variant(@state; @background; @color) {
470 .list-group-item-@{state} {
472 background-color: @background;
477 .list-group-item-heading { color: inherit; }
482 background-color: darken(@background, 5%);
488 background-color: @color;
489 border-color: @color;
496 // -------------------------
497 // Easily pump out default styles, as well as :hover, :focus, :active,
498 // and disabled options for all buttons
499 .button-variant(@color; @background; @border) {
501 background-color: @background;
502 border-color: @border;
508 .open .dropdown-toggle& {
510 background-color: darken(@background, 8%);
511 border-color: darken(@border, 12%);
515 .open .dropdown-toggle& {
516 background-image: none;
520 fieldset[disabled] & {
526 background-color: @background;
527 border-color: @border;
533 background-color: @color;
538 // -------------------------
539 .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
540 padding: @padding-vertical @padding-horizontal;
541 font-size: @font-size;
542 line-height: @line-height;
543 border-radius: @border-radius;
547 // -------------------------
548 .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
552 padding: @padding-vertical @padding-horizontal;
553 font-size: @font-size;
558 .border-left-radius(@border-radius);
564 .border-right-radius(@border-radius);
571 // -------------------------
572 .label-variant(@color) {
573 background-color: @color;
577 background-color: darken(@color, 10%);
582 // Contextual backgrounds
583 // -------------------------
584 .bg-variant(@color) {
585 background-color: @color;
587 background-color: darken(@color, 10%);
592 // -------------------------
593 .text-emphasis-variant(@color) {
596 color: darken(@color, 10%);
600 // Navbar vertical align
601 // -------------------------
602 // Vertically center elements in the navbar.
603 // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
604 .navbar-vertical-align(@element-height) {
605 margin-top: ((@navbar-height - @element-height) / 2);
606 margin-bottom: ((@navbar-height - @element-height) / 2);
610 // -------------------------
611 .progress-bar-variant(@color) {
612 background-color: @color;
613 .progress-striped & {
614 #gradient > .striped();
618 // Responsive utilities
619 // -------------------------
620 // More easily include all the states for responsive-utilities.less.
621 .responsive-visibility() {
622 display: block !important;
623 table& { display: table; }
624 tr& { display: table-row !important; }
626 td& { display: table-cell !important; }
629 .responsive-invisibility() {
630 display: none !important;
637 // Centered container element
641 padding-left: (@grid-gutter-width / 2);
642 padding-right: (@grid-gutter-width / 2);
643 &:extend(.clearfix all);
646 // Creates a wrapper for a series of columns
647 .make-row(@gutter: @grid-gutter-width) {
648 margin-left: (@gutter / -2);
649 margin-right: (@gutter / -2);
650 &:extend(.clearfix all);
653 // Generate the extra small columns
654 .make-xs-column(@columns; @gutter: @grid-gutter-width) {
657 width: percentage((@columns / @grid-columns));
659 padding-left: (@gutter / 2);
660 padding-right: (@gutter / 2);
662 .make-xs-column-offset(@columns) {
663 @media (min-width: @screen-xs-min) {
664 margin-left: percentage((@columns / @grid-columns));
667 .make-xs-column-push(@columns) {
668 @media (min-width: @screen-xs-min) {
669 left: percentage((@columns / @grid-columns));
672 .make-xs-column-pull(@columns) {
673 @media (min-width: @screen-xs-min) {
674 right: percentage((@columns / @grid-columns));
679 // Generate the small columns
680 .make-sm-column(@columns; @gutter: @grid-gutter-width) {
683 padding-left: (@gutter / 2);
684 padding-right: (@gutter / 2);
686 @media (min-width: @screen-sm-min) {
688 width: percentage((@columns / @grid-columns));
691 .make-sm-column-offset(@columns) {
692 @media (min-width: @screen-sm-min) {
693 margin-left: percentage((@columns / @grid-columns));
696 .make-sm-column-push(@columns) {
697 @media (min-width: @screen-sm-min) {
698 left: percentage((@columns / @grid-columns));
701 .make-sm-column-pull(@columns) {
702 @media (min-width: @screen-sm-min) {
703 right: percentage((@columns / @grid-columns));
708 // Generate the medium columns
709 .make-md-column(@columns; @gutter: @grid-gutter-width) {
712 padding-left: (@gutter / 2);
713 padding-right: (@gutter / 2);
715 @media (min-width: @screen-md-min) {
717 width: percentage((@columns / @grid-columns));
720 .make-md-column-offset(@columns) {
721 @media (min-width: @screen-md-min) {
722 margin-left: percentage((@columns / @grid-columns));
725 .make-md-column-push(@columns) {
726 @media (min-width: @screen-md-min) {
727 left: percentage((@columns / @grid-columns));
730 .make-md-column-pull(@columns) {
731 @media (min-width: @screen-md-min) {
732 right: percentage((@columns / @grid-columns));
737 // Generate the large columns
738 .make-lg-column(@columns; @gutter: @grid-gutter-width) {
741 padding-left: (@gutter / 2);
742 padding-right: (@gutter / 2);
744 @media (min-width: @screen-lg-min) {
746 width: percentage((@columns / @grid-columns));
749 .make-lg-column-offset(@columns) {
750 @media (min-width: @screen-lg-min) {
751 margin-left: percentage((@columns / @grid-columns));
754 .make-lg-column-push(@columns) {
755 @media (min-width: @screen-lg-min) {
756 left: percentage((@columns / @grid-columns));
759 .make-lg-column-pull(@columns) {
760 @media (min-width: @screen-lg-min) {
761 right: percentage((@columns / @grid-columns));
766 // Framework grid generation
768 // Used only by Bootstrap to generate the correct number of grid classes given
769 // any value of `@grid-columns`.
771 .make-grid-columns() {
772 // Common styles for all sizes of grid columns, widths 1-12
773 .col(@index) when (@index = 1) { // initial
774 @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
775 .col((@index + 1), @item);
777 .col(@index, @list) when (@index =< @grid-columns) { // general; "=<" isn't a typo
778 @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}";
779 .col((@index + 1), ~"@{list}, @{item}");
781 .col(@index, @list) when (@index > @grid-columns) { // terminal
784 // Prevent columns from collapsing when empty
786 // Inner gutter via padding
787 padding-left: (@grid-gutter-width / 2);
788 padding-right: (@grid-gutter-width / 2);
791 .col(1); // kickstart it
794 .float-grid-columns(@class) {
795 .col(@index) when (@index = 1) { // initial
796 @item: ~".col-@{class}-@{index}";
797 .col((@index + 1), @item);
799 .col(@index, @list) when (@index =< @grid-columns) { // general
800 @item: ~".col-@{class}-@{index}";
801 .col((@index + 1), ~"@{list}, @{item}");
803 .col(@index, @list) when (@index > @grid-columns) { // terminal
808 .col(1); // kickstart it
811 .calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {
812 .col-@{class}-@{index} {
813 width: percentage((@index / @grid-columns));
816 .calc-grid-column(@index, @class, @type) when (@type = push) {
817 .col-@{class}-push-@{index} {
818 left: percentage((@index / @grid-columns));
821 .calc-grid-column(@index, @class, @type) when (@type = pull) {
822 .col-@{class}-pull-@{index} {
823 right: percentage((@index / @grid-columns));
826 .calc-grid-column(@index, @class, @type) when (@type = offset) {
827 .col-@{class}-offset-@{index} {
828 margin-left: percentage((@index / @grid-columns));
832 // Basic looping in LESS
833 .loop-grid-columns(@index, @class, @type) when (@index >= 0) {
834 .calc-grid-column(@index, @class, @type);
836 .loop-grid-columns((@index - 1), @class, @type);
839 // Create grid for specific class
841 .float-grid-columns(@class);
842 .loop-grid-columns(@grid-columns, @class, width);
843 .loop-grid-columns(@grid-columns, @class, pull);
844 .loop-grid-columns(@grid-columns, @class, push);
845 .loop-grid-columns(@grid-columns, @class, offset);
848 // Form validation states
850 // Used in forms.less to generate the form validation CSS for warnings, errors,
853 .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {
854 // Color the label and help text
863 // Set the border and box shadow on specific inputs to match
865 border-color: @border-color;
866 .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
868 border-color: darken(@border-color, 10%);
869 @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
870 .box-shadow(@shadow);
873 // Set validation states also for addons
876 border-color: @border-color;
877 background-color: @background-color;
879 // Optional feedback icon
880 .form-control-feedback {
885 // Form control focus state
887 // Generate a customized focus state and for any input with the specified color,
888 // which defaults to the `@input-focus-border` variable.
890 // We highly encourage you to not customize the default value, but instead use
891 // this to tweak colors on an as-needed basis. This aesthetic change is based on
892 // WebKit's default styles, but applicable to a wider range of browsers. Its
893 // usability and accessibility should be taken into account with any change.
895 // Example usage: change the default blue border and shadow to white for better
896 // contrast against a dark gray background.
898 .form-control-focus(@color: @input-border-focus) {
899 @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
901 border-color: @color;
903 .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
907 // Form control sizing
909 // Relative text size, padding, and border-radii changes for form controls. For
910 // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
911 // element gets special love because it's special, and that's a fact!
913 .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
914 height: @input-height;
915 padding: @padding-vertical @padding-horizontal;
916 font-size: @font-size;
917 line-height: @line-height;
918 border-radius: @border-radius;
921 height: @input-height;
922 line-height: @input-height;