diff --git a/docs/less.html b/docs/less.html index ac75dd3469..e10c8899b0 100644 --- a/docs/less.html +++ b/docs/less.html @@ -105,11 +105,11 @@
Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though—assign colors or pixel values as variables and change them once.
Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.
Mixins are basically includes or partials for CSS, allowing you to combine a block of code into one. They’re great for vendor prefixed properties like box-shadow
, cross-browser gradients, font stacks, and more. Below is a sample of the mixins that are included with Bootstrap.
A basic mixin is essentially an include or a partial for a snippet of CSS. They're written just like a CSS class and can be called anywhere.
-#font { - .shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) { - font-size: @size; - font-weight: @weight; - line-height: @lineHeight; - } - .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; - } - ... -} + Coming soon!-
A parametric mixin is just like a basic mixin, but it also accepts optional paramaters (hence the name).
-#gradient { - ... - .vertical (@startColor: #555, @endColor: #333) { - background-color: @endColor; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror - background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+ - background-image: -ms-linear-gradient(@startColor, @endColor); // IE10 - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+ - background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10 - background-image: linear-gradient(@startColor, @endColor); // The standard - } - ... -} + Coming soon!+
Nearly all of Bootstrap's mixins are stored in mixins.less, a wonderful utility .less file that enables you to use a mixin in any of the .less files in the toolkit.
+So, go ahead and use the existing ones or feel free to add your own as you need.
+Mixin | +Paramaters | +Usage | +
---|---|---|
.clearfix() |
+ + | + |
.center-block() |
+ + | + |
.ie7-inline-block() |
+ + | + |
.size() |
+ + | + |
.square() |
+ + | + |
.opacity() |
+ + | + |
.reset-filter() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.placeholder() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
#font > #family > .serif() |
+ + | + |
#font > #family > .sans-serif() |
+ + | + |
#font > #family > .monospace() |
+ + | + |
#font > .shorthand() |
+ + | + |
#font > .serif() |
+ + | + |
#font > .sans-serif() |
+ + | + |
#font > .monospace() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.fixed-container() |
+ + | + |
.columns() |
+ + | + |
.offset() |
+ + | + |
.gridColumn() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.border-radius() |
+ + | + |
.border-radius-custom() |
+ + | + |
.box-shadow() |
+ + | + |
.transition() |
+ + | + |
.rotate() |
+ + | + |
.scale() |
+ + | + |
.translate() |
+ + | + |
.background-clip() |
+ + | + |
.background-size() |
+ + | + |
.box-sizing() |
+ + | + |
.user-select() |
+ + | + |
.resizable() |
+ + | + |
.content-columns() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.#translucent > .background() |
+ + | + |
.#translucent > .border() |
+ + | + |
.#gradient > .vertical() |
+ + | + |
.#gradient > .horizontal() |
+ + | + |
.#gradient > .directional() |
+ + | + |
.#gradient > .vertical-three-colors() |
+ + | + |
.#gradient > .radial() |
+ + | + |
.#gradient > .striped() |
+ + | + |
.#gradientBar() |
+ + | + |
Get fancy and perform some math to generate flexible and powerful mixins like the one below.
--// Griditude -@gridColumns: 16; -@gridColumnWidth: 40px; -@gridGutterWidth: 20px; -@siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1)); - -// Make some columns -.columns(@columnSpan: 1) { - width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)); -} --
{{_i}}Mixins are basically includes or partials for CSS, allowing you to combine a block of code into one. They’re great for vendor prefixed properties like box-shadow
, cross-browser gradients, font stacks, and more. Below is a sample of the mixins that are included with Bootstrap.{{/i}}
A basic mixin is essentially an include or a partial for a snippet of CSS. They're written just like a CSS class and can be called anywhere.
-#font { - .shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) { - font-size: @size; - font-weight: @weight; - line-height: @lineHeight; - } - .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; - } - ... -} + Coming soon!-
A parametric mixin is just like a basic mixin, but it also accepts optional paramaters (hence the name).
-#gradient { - ... - .vertical (@startColor: #555, @endColor: #333) { - background-color: @endColor; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror - background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+ - background-image: -ms-linear-gradient(@startColor, @endColor); // IE10 - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+ - background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10 - background-image: linear-gradient(@startColor, @endColor); // The standard - } - ... -} + Coming soon!+
Nearly all of Bootstrap's mixins are stored in mixins.less, a wonderful utility .less file that enables you to use a mixin in any of the .less files in the toolkit.
+So, go ahead and use the existing ones or feel free to add your own as you need.
+Mixin | +Paramaters | +Usage | +
---|---|---|
.clearfix() |
+ + | + |
.center-block() |
+ + | + |
.ie7-inline-block() |
+ + | + |
.size() |
+ + | + |
.square() |
+ + | + |
.opacity() |
+ + | + |
.reset-filter() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.placeholder() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
#font > #family > .serif() |
+ + | + |
#font > #family > .sans-serif() |
+ + | + |
#font > #family > .monospace() |
+ + | + |
#font > .shorthand() |
+ + | + |
#font > .serif() |
+ + | + |
#font > .sans-serif() |
+ + | + |
#font > .monospace() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.fixed-container() |
+ + | + |
.columns() |
+ + | + |
.offset() |
+ + | + |
.gridColumn() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.border-radius() |
+ + | + |
.border-radius-custom() |
+ + | + |
.box-shadow() |
+ + | + |
.transition() |
+ + | + |
.rotate() |
+ + | + |
.scale() |
+ + | + |
.translate() |
+ + | + |
.background-clip() |
+ + | + |
.background-size() |
+ + | + |
.box-sizing() |
+ + | + |
.user-select() |
+ + | + |
.resizable() |
+ + | + |
.content-columns() |
+ + | + |
Mixin | +Paramaters | +Usage | +
---|---|---|
.#translucent > .background() |
+ + | + |
.#translucent > .border() |
+ + | + |
.#gradient > .vertical() |
+ + | + |
.#gradient > .horizontal() |
+ + | + |
.#gradient > .directional() |
+ + | + |
.#gradient > .vertical-three-colors() |
+ + | + |
.#gradient > .radial() |
+ + | + |
.#gradient > .striped() |
+ + | + |
.#gradientBar() |
+ + | + |
{{_i}}Get fancy and perform some math to generate flexible and powerful mixins like the one below.{{/i}}
--// Griditude -@gridColumns: 16; -@gridColumnWidth: 40px; -@gridGutterWidth: 20px; -@siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1)); - -// Make some columns -.columns(@columnSpan: 1) { - width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)); -} -