diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index b7b304014e..26dddb1b8a 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -741,8 +741,8 @@ pre code { } .row { - margin-right: -10px; - margin-left: -10px; + margin-right: -15px; + margin-left: -15px; } .row:before, @@ -756,9 +756,10 @@ pre code { } [class^="span"] { + position: relative; min-height: 1px; - padding-right: 10px; - padding-left: 10px; + padding-right: 15px; + padding-left: 15px; } @media screen and (min-width: 768px) { @@ -840,6 +841,78 @@ pre code { .offset1 { margin-left: 8.333333333333332%; } + .push12 { + left: 100%; + } + .push11 { + left: 91.66666666666666%; + } + .push10 { + left: 83.33333333333334%; + } + .push9 { + left: 75%; + } + .push8 { + left: 66.66666666666666%; + } + .push7 { + left: 58.333333333333336%; + } + .push6 { + left: 50%; + } + .push5 { + left: 41.66666666666667%; + } + .push4 { + left: 33.33333333333333%; + } + .push3 { + left: 25%; + } + .push2 { + left: 16.666666666666664%; + } + .push1 { + left: 8.333333333333332%; + } + .pull12 { + right: 100%; + } + .pull11 { + right: 91.66666666666666%; + } + .pull10 { + right: 83.33333333333334%; + } + .pull9 { + right: 75%; + } + .pull8 { + right: 66.66666666666666%; + } + .pull7 { + right: 58.333333333333336%; + } + .pull6 { + right: 50%; + } + .pull5 { + right: 41.66666666666667%; + } + .pull4 { + right: 33.33333333333333%; + } + .pull3 { + right: 25%; + } + .pull2 { + right: 16.666666666666664%; + } + .pull1 { + right: 8.333333333333332%; + } } @media screen and (min-width: 992px) { @@ -852,14 +925,6 @@ pre code { .container { max-width: 1170px; } - .row { - margin-right: -15px; - margin-left: -15px; - } - [class^="span"] { - padding-right: 15px; - padding-left: 15px; - } } [class*="span"].pull-right { diff --git a/docs/css.html b/docs/css.html index fd6faa1734..2116ad3d82 100644 --- a/docs/css.html +++ b/docs/css.html @@ -23,7 +23,7 @@ title: CSS
Bootstrap utilizes a responsive, percent-based grid system, that scales up appropriately as devices and viewport sizes increase. In other words, it's mobile first.
+Bootstrap includes a responsive, percent-based grid system that appropriately scales up to 12 columns as the device or viewport size increases—in other words, it's mobile first. It includes predefined classes for this, as well as powerful mixins for generating semantic layouts.
-On mobile devices, the grid starts out stacked. Above 768px, it becomes horizontal as media queries kick in to apply float
s and width
s. To create a basic grid layout, wrap a series of .span*
elements within a .row
. As this is a 12-column grid, each .span*
spans a number of those 12 columns, and should always add up to 12 for each row (or the number of columns in the parent), even at mobile resolutions.
Move columns to the right using .offset*
classes. Each class increases the left margin of a column by a whole column. For example, .offset4
moves .span4
over four columns.
To nest your content with the default grid, add a new .row
and set of .span*
columns within an existing .span*
column. Nested rows should include a set of columns that add up to 12.
Easily the order of our built-in grid columns with .push*
and .pull*
modifier classes.
In addition to prebuilt grid classes for fast layouts, Bootstrap includes LESS variables and mixins for quickly generating your own simple, semantic layouts.
+ +Variables determine the number of columns, the gutter width, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.
+{% highlight css linenos %} +@grid-columns: 12; +@grid-gutter-width: 30px; +@grid-float-breakpoint: 768px; +{% endhighlight %} + +Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
+{% highlight css linenos %} +// Creates a wrapper for a series of columns +.make-row() { + // Negative margin the row out to align the content of columns + margin-left: (@grid-gutter-width / -2); + margin-right: (@grid-gutter-width / -2); + // Then clear the floated columns + .clear_float(); +} + +// Generate the columns +.make-column(@columns) { + @media (min-width: @grid-float-breakpoint) { + float: left; + // Calculate width based on number of columns available + width: percentage(@columns / @grid-columns); + } + // Prevent columns from collapsing when empty + min-height: 1px; + // Set inner padding as gutters instead of margin + padding-left: (@grid-gutter-width / 2); + padding-right: (@grid-gutter-width / 2); +} + +// Generate the column offsets +.make-column-offset(@columns) { + @media (min-width: @grid-float-breakpoint) { + margin-left: percentage((@columns / @grid-columns)); + } +} +{% endhighlight %} + +You can modify the variables to your own custom values, or just use the mixins with their default values. Here's an example of using the default settings to create a two-column layout with a gap between.
+{% highlight css linenos %} +.wrapper { + .make-row(); +} +.content-main { + .make-column(8); +} +.content-secondary { + .make-column(3); + .make-column-offset(1); +} +{% endhighlight %} +{% highlight html linenos %} +