2 // Snippets of reusable CSS to develop faster and keep code readable
3 // -----------------------------------------------------------------
7 // --------------------------------------------------
11 // For clearing floats like a boss h5bp.com/q
28 outline: thin dotted #333;
30 outline: 5px auto -webkit-focus-ring-color;
34 // Center-align a block level element
35 // ----------------------------------
45 *display: inline; /* IE7 inline-block hack */
49 // IE7 likes to collapse whitespace on either side of the inline-block elements.
50 // Ems because we're attempting to match the width of a space character. Left
51 // version is for form buttons, which typically come after other elements, and
52 // right version is for icons, which come before. Applying both is ok, but it will
53 // mean that space between those elements will be .6em (~2 space characters) in IE7,
54 // instead of the 1 space in other browsers.
55 .ie7-restore-left-whitespace() {
63 .ie7-restore-right-whitespace() {
72 // -------------------------
73 .size(@height: 5px, @width: 5px) {
82 // -------------------------
83 .placeholder(@color: @placeholderText) {
87 ::-webkit-input-placeholder {
93 // -------------------------
94 // Requires inline-block or block for proper styling
97 text-overflow: ellipsis;
104 // --------------------------------------------------
109 font-family: Georgia, "Times New Roman", Times, serif;
112 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
115 font-family: Menlo, Monaco, "Courier New", monospace;
118 .shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
120 font-weight: @weight;
121 line-height: @lineHeight;
123 .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
124 #font > #family > .serif;
125 #font > .shorthand(@size, @weight, @lineHeight);
127 .sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
128 #font > #family > .sans-serif;
129 #font > .shorthand(@size, @weight, @lineHeight);
131 .monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
132 #font > #family > .monospace;
133 #font > .shorthand(@size, @weight, @lineHeight);
140 // --------------------------------------------------
143 // -------------------------
145 width: @gridRowWidth;
152 // -------------------------
154 // Setup the mixins to be used
155 .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, @columns) {
156 width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
158 .offset(@gridColumnWidth, @gridGutterWidth, @columns) {
159 margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2);
161 .gridColumn(@gridGutterWidth) {
163 margin-left: @gridGutterWidth;
165 // Take these values and mixins, and make 'em do their thang
166 .generate(@gridColumns, @gridColumnWidth, @gridGutterWidth) {
167 // Row surrounds the columns
169 margin-left: @gridGutterWidth * -1;
172 // Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7, thanks @dhg)
174 #gridSystem > .gridColumn(@gridGutterWidth);
177 .span1 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 1); }
178 .span2 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 2); }
179 .span3 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 3); }
180 .span4 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 4); }
181 .span5 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 5); }
182 .span6 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 6); }
183 .span7 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 7); }
184 .span8 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 8); }
185 .span9 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 9); }
186 .span10 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 10); }
187 .span11 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 11); }
189 .container { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 12); }
190 // Offset column options
191 .offset1 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 1); }
192 .offset2 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 2); }
193 .offset3 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 3); }
194 .offset4 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 4); }
195 .offset5 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 5); }
196 .offset6 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 6); }
197 .offset7 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 7); }
198 .offset8 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 8); }
199 .offset9 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 9); }
200 .offset10 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 10); }
201 .offset11 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 11); }
206 // -------------------------
208 // Setup the mixins to be used
209 .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, @columns) {
210 width: 1% * (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
212 .gridColumn(@fluidGridGutterWidth) {
214 margin-left: @fluidGridGutterWidth;
216 // Take these values and mixins, and make 'em do their thang
217 .generate(@gridColumns, @fluidGridColumnWidth, @fluidGridGutterWidth) {
218 // Row surrounds the columns
223 // Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7, thanks @dhg)
225 #fluidGridSystem > .gridColumn(@fluidGridGutterWidth);
227 > [class*="span"]:first-child {
231 > .span1 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 1); }
232 > .span2 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 2); }
233 > .span3 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 3); }
234 > .span4 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 4); }
235 > .span5 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 5); }
236 > .span6 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 6); }
237 > .span7 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 7); }
238 > .span8 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 8); }
239 > .span9 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 9); }
240 > .span10 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 10); }
241 > .span11 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 11); }
242 > .span12 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 12); }
248 // -------------------------
250 .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, @columns) {
251 width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 10;
253 .generate(@gridColumns, @gridColumnWidth, @gridGutterWidth) {
257 &.span1 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 1); }
258 &.span2 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 2); }
259 &.span3 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 3); }
260 &.span4 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 4); }
261 &.span5 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 5); }
262 &.span6 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 6); }
263 &.span7 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 7); }
264 &.span8 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 8); }
265 &.span9 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 9); }
266 &.span10 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 10); }
267 &.span11 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 11); }
268 &.span12 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 12); }
274 // -------------------------
275 // Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
277 margin-left: @gridGutterWidth * -1;
280 .makeColumn(@columns: 1) {
282 margin-left: @gridGutterWidth;
283 width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
288 // Form field states (used in forms.less)
289 // --------------------------------------------------
291 // Mixin for form field states
292 .formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) {
293 // Set the text color
299 // Style inputs accordingly
304 border-color: @borderColor;
306 border-color: darken(@borderColor, 10%);
307 .box-shadow(0 0 6px lighten(@borderColor, 20%));
310 // Give a small background color for input-prepend/-append
311 .input-prepend .add-on,
312 .input-append .add-on {
314 background-color: @backgroundColor;
315 border-color: @textColor;
322 // --------------------------------------------------
325 .border-radius(@radius: 2px) {
326 -webkit-border-radius: @radius;
327 -moz-border-radius: @radius;
328 border-radius: @radius;
332 .box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
333 -webkit-box-shadow: @shadow;
334 -moz-box-shadow: @shadow;
339 .transition(@transition) {
340 -webkit-transition: @transition;
341 -moz-transition: @transition;
342 -ms-transition: @transition;
343 -o-transition: @transition;
344 transition: @transition;
349 -webkit-transform: rotate(@degrees);
350 -moz-transform: rotate(@degrees);
351 -ms-transform: rotate(@degrees);
352 -o-transform: rotate(@degrees);
353 transform: rotate(@degrees);
356 -webkit-transform: scale(@ratio);
357 -moz-transform: scale(@ratio);
358 -ms-transform: scale(@ratio);
359 -o-transform: scale(@ratio);
360 transform: scale(@ratio);
362 .translate(@x: 0, @y: 0) {
363 -webkit-transform: translate(@x, @y);
364 -moz-transform: translate(@x, @y);
365 -ms-transform: translate(@x, @y);
366 -o-transform: translate(@x, @y);
367 transform: translate(@x, @y);
369 .skew(@x: 0, @y: 0) {
370 -webkit-transform: skew(@x, @y);
371 -moz-transform: skew(@x, @y);
372 -ms-transform: skew(@x, @y);
373 -o-transform: skew(@x, @y);
374 transform: skew(@x, @y);
376 .translate3d(@x: 0, @y: 0, @z: 0) {
377 -webkit-transform: translate(@x, @y, @z);
378 -moz-transform: translate(@x, @y, @z);
379 -ms-transform: translate(@x, @y, @z);
380 -o-transform: translate(@x, @y, @z);
381 transform: translate(@x, @y, @z);
384 // Background clipping
385 // Heads up: FF 3.6 and under need "padding" instead of "padding-box"
386 .background-clip(@clip) {
387 -webkit-background-clip: @clip;
388 -moz-background-clip: @clip;
389 background-clip: @clip;
393 .background-size(@size){
394 -webkit-background-size: @size;
395 -moz-background-size: @size;
396 -o-background-size: @size;
397 background-size: @size;
402 .box-sizing(@boxmodel) {
403 -webkit-box-sizing: @boxmodel;
404 -moz-box-sizing: @boxmodel;
405 box-sizing: @boxmodel;
409 // For selecting text on the page
410 .user-select(@select) {
411 -webkit-user-select: @select;
412 -moz-user-select: @select;
413 -o-user-select: @select;
414 user-select: @select;
418 .resizable(@direction: both) {
419 resize: @direction; // Options: horizontal, vertical, both
420 overflow: auto; // Safari fix
423 // CSS3 Content Columns
424 .content-columns(@columnCount, @columnGap: @gridColumnGutter) {
425 -webkit-column-count: @columnCount;
426 -moz-column-count: @columnCount;
427 column-count: @columnCount;
428 -webkit-column-gap: @columnGap;
429 -moz-column-gap: @columnGap;
430 column-gap: @columnGap;
434 .opacity(@opacity: 100) {
435 opacity: @opacity / 100;
436 filter: e(%("alpha(opacity=%d)", @opacity));
442 // --------------------------------------------------
444 // Add an alphatransparency value to any background or border color (via Elyse Holladay)
446 .background(@color: @white, @alpha: 1) {
447 background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
449 .border(@color: @white, @alpha: 1) {
450 border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
451 .background-clip(padding-box);
455 // Gradient Bar Colors for buttons and alerts
456 .gradientBar(@primaryColor, @secondaryColor) {
457 #gradient > .vertical(@primaryColor, @secondaryColor);
458 border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
459 border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
464 .horizontal(@startColor: #555, @endColor: #333) {
465 background-color: @endColor;
466 background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
467 background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
468 background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
469 background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
470 background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
471 background-image: linear-gradient(left, @startColor, @endColor); // Le standard
472 background-repeat: repeat-x;
473 filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down
475 .vertical(@startColor: #555, @endColor: #333) {
476 background-color: mix(@startColor, @endColor, 60%);
477 background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
478 background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
479 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
480 background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
481 background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
482 background-image: linear-gradient(top, @startColor, @endColor); // The standard
483 background-repeat: repeat-x;
484 filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down
486 .directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
487 background-color: @endColor;
488 background-repeat: repeat-x;
489 background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
490 background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10
491 background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
492 background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
493 background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
495 .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
496 background-color: mix(@midColor, @endColor, 80%);
497 background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
498 background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
499 background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
500 background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor);
501 background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
502 background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
503 background-repeat: no-repeat;
504 filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down, gets no color-stop at all for proper fallback
506 .radial(@innerColor: #555, @outerColor: #333) {
507 background-color: @outerColor;
508 background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor));
509 background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor);
510 background-image: -moz-radial-gradient(circle, @innerColor, @outerColor);
511 background-image: -ms-radial-gradient(circle, @innerColor, @outerColor);
512 background-repeat: no-repeat;
513 // Opera cannot do radial gradients yet
515 .striped(@color, @angle: -45deg) {
516 background-color: @color;
517 background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent));
518 background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
519 background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
520 background-image: -ms-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
521 background-image: -o-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
522 background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
525 // Reset filters for IE
527 filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
531 // Mixin for generating button backgrounds
532 // ---------------------------------------
533 .buttonBackground(@startColor, @endColor) {
534 // gradientBar will set the background to a pleasing blend of these, to support IE<=9
535 .gradientBar(@startColor, @endColor);
538 // in these cases the gradient won't cover the background, so we override
539 &:hover, &:active, &.active, &.disabled, &[disabled] {
540 background-color: @endColor;
543 // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
546 background-color: darken(@endColor, 10%) e("\9");
552 // --------------------------------------------------
555 // -------------------------
556 // For tipsies and popovers
558 .top(@arrowWidth: 5px) {
561 margin-left: -@arrowWidth;
562 border-left: @arrowWidth solid transparent;
563 border-right: @arrowWidth solid transparent;
564 border-top: @arrowWidth solid @black;
566 .topright(@arrowWidth: 5px) {
570 right: @arrowWidth*3;
571 margin-left: -@arrowWidth;
572 border-left: @arrowWidth solid transparent;
573 border-right: @arrowWidth solid transparent;
574 border-top: @arrowWidth solid @black;
575 border-bottom: 0px none;
577 .topleft(@arrowWidth: 5px) {
582 margin-left: -@arrowWidth;
583 border-left: @arrowWidth solid transparent;
584 border-right: @arrowWidth solid transparent;
585 border-top: @arrowWidth solid @black;
586 border-bottom: 0px none;
588 .left(@arrowWidth: 5px) {
591 margin-top: -@arrowWidth;
592 border-top: @arrowWidth solid transparent;
593 border-bottom: @arrowWidth solid transparent;
594 border-left: @arrowWidth solid @black;
596 .bottom(@arrowWidth: 5px) {
599 margin-left: -@arrowWidth;
600 border-left: @arrowWidth solid transparent;
601 border-right: @arrowWidth solid transparent;
602 border-bottom: @arrowWidth solid @black;
604 .bottomleft(@arrowWidth: 5px) {
607 margin-left: -@arrowWidth;
608 border-left: @arrowWidth solid transparent;
609 border-right: @arrowWidth solid transparent;
610 border-bottom: @arrowWidth solid @black;
612 .bottomright(@arrowWidth: 5px) {
614 right: @arrowWidth*3;
616 margin-left: -@arrowWidth;
617 border-left: @arrowWidth solid transparent;
618 border-right: @arrowWidth solid transparent;
619 border-bottom: @arrowWidth solid @black;
621 .right(@arrowWidth: 5px) {
624 margin-top: -@arrowWidth;
625 border-top: @arrowWidth solid transparent;
626 border-bottom: @arrowWidth solid transparent;
627 border-right: @arrowWidth solid @black;