48 merge requests!28721Hot test,!27561Adds font-weight-medium to font weight classes,!26437merge,!26197V4 dev xmr,!20778V4 dev,!20539Allow multiple modals,!18047#17986,!18988Blockquote border width,!20854Fixes 15534,!19272V4 dev xmr grunt html,!17218Issue 17066,!19581V4 fix popover,!18283Tether docs fix,!17229Include documentation for .navbar-static-top,!20493V4 dev display,!20636Fix docs for heading sizes,!19824blockquote-center,!22547Finished a new translation for bootstrap,!19534Docs 17264,!19533Npm deps,!22143Fix selectable disabled toggle radio buttons,!19084V4 rhythm,!18085Ie9 click comment,!22598test,!18829Add prefix to carousel classes,!18581Check getting started files for broken links - Issue 18568,!18067replace grunt-autoprefixer with gruntpostcss + autoprefixer,!20099V4.0.0 alpha.3,!20438V4 grid classes,!17307Vertical alignment on Bootstrap columns with equal height,!18477add utility color-contrast function,!18864Feature/navbar toggler support color schemes,!19602V4 palettes arun,!18311V4 dev xmr,!19448New pull request for testing,!19358XXL grid size,!19825.blockquote-center,!17508Fix usage of “its” and “it’s” (v4 docs),!25326Adjust examples,!23995Add back cursor: pointer for .btn-link,!23178Spinner,!19754Issue template,!19753Card img overlay padding,!19747Blockquote border width,!19580ExitStars,!18684Docs: change "Button" to "Go somewhere",!18661Docs: accessibility fix-up of collapsible content navbar, change site-wide main navbar,!17021v4
Bootstrap includes a powerful mobile-first grid system for building layouts of all shapes and sizes based on a 12 column layout.
Bootstrap includes a powerful mobile-first grid system for building layouts of all shapes and sizes based on a 12 column layout. There are multiple tiers, one for each [media query range]({{ site.baseurl }}/layout/media-queries/), made available via our predefined classes or semantic mixins.
There are multiple tiers for different device sizes, available via our predefined classes or semantic mixins.
Here's how the grid system works:
- There are three major components—containers, rows, and columns.
- Containers—`.container` for fixed width or `.container-fluid` for full width—center your site's contents.
- Rows are horizontal groups of columns that clear floats (when not in [flexbox mode]({{ site.baseurl }}/getting-started/flexbox/)).
- Content should be placed within columns, and only columns may be immediate children of rows.
- You can use predefined grid classes or Sass mixins for more semantic markup.
## Contents
## Contents
* Will be replaced with the ToC, excluding the "Contents" header
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
{:toc}
### Quick start
## Quick start
- Example grid class
- Example grid class
- Example mixins
- Example mixins
### Introduction
## Introduction
Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here's how the Bootstrap grid system works:
Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here's how the Bootstrap grid system works:
...
@@ -34,7 +40,7 @@ Grid systems are used for creating page layouts through a series of rows and col
...
@@ -34,7 +40,7 @@ Grid systems are used for creating page layouts through a series of rows and col
Look to the examples for applying these principles to your code.
Look to the examples for applying these principles to your code.
### Grid options
## Grid options
See how aspects of the Bootstrap grid system work across multiple devices with a handy table.
See how aspects of the Bootstrap grid system work across multiple devices with a handy table.
...
@@ -111,20 +117,33 @@ See how aspects of the Bootstrap grid system work across multiple devices with a
...
@@ -111,20 +117,33 @@ See how aspects of the Bootstrap grid system work across multiple devices with a
</table>
</table>
</div>
</div>
### Semantic mixins
## Sass mixins
In addition to [prebuilt grid classes](#grid-example-basic) for fast layouts, Bootstrap includes Sass variables and mixins for quickly generating your own simple, semantic layouts.
When using Bootstrap's source Sass files, you have the option of using Sass variables and mixins to create custom, semantic, and responsive page layouts. Our [prebuilt grid classes](#grid-example-basic) use these same variables and mixins to provide a whole suite of ready-to-use classes for fast responsive layouts.
#### Variables
### Variables
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.
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 scss %}
{% highlight scss %}
$grid-breakpoints: (
// Extra small screen / phone
xs: 0,
// Small screen / phone
sm: 34em,
// Medium screen / tablet
md: 48em,
// Large screen / desktop
lg: 62em,
// Extra large screen / wide desktop
xl: 75em
) !default;
$grid-columns: 12;
$grid-columns: 12;
$grid-gutter-width: 1.5rem;
$grid-gutter-width: 1.5rem;
{% endhighlight %}
{% endhighlight %}
#### Mixins
### Mixins
Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
...
@@ -162,7 +181,7 @@ Mixins are used in conjunction with the grid variables to generate semantic CSS
...
@@ -162,7 +181,7 @@ Mixins are used in conjunction with the grid variables to generate semantic CSS
}
}
{% endhighlight %}
{% endhighlight %}
#### Example usage
### Example usage
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.
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.