1<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
2
3
4<div class="row">
5 <div class="col-md-4">
6 <div class="well">1
7 <br/>
8 <br/>
9 <br/>
10 <br/>
11 <br/>
12 </div>
13 </div>
14 <div class="col-md-8">
15 <div class="row">
16 <div class="col-md-6">
17 <div class="well">2</div>
18 </div>
19 <div class="col-md-6">
20 <div class="well">3</div>
21 </div>
22 </div>
23 <div class="row">
24 <div class="col-md-6">
25 <div class="well">4</div>
26 </div>
27 <div class="col-md-6">
28 <div class="well">5</div>
29 </div>
30 </div>
31 </div>
32</div>
33<div class="row">
34 <div class="col-md-4">
35 <div class="well">6</div>
36 </div>
37 <div class="col-md-4">
38 <div class="well">7</div>
39 </div>
40 <div class="col-md-4">
41 <div class="well">8</div>
42 </div>
43</div>
1<!- BOOTSTRAP GRID SYSTEM ------------------------>
2Extra small .col- <576px Mobile Display
3Small .col-sm- ≥576px Mobile Display
4Medium .col-md- ≥768px Tablet Display
5Large .col-lg- ≥992px Desktop Display
6Extra large .col-xl- ≥1200px Desktop Display
7
8 <div class="row">
9 <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:red; border:1px solid black;">
10 One of four columns
11 </div>
12 <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border:1px solid black;">
13 One of four columns
14 </div>
15 <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:green; border:1px solid black;">
16 One of four columns
17 </div>
18 <div class="col-lg-3 col-md-4 col-sm-6" style="border:1px solid black;">
19 One of four columns
20 </div>
21 </div>
22
1<div class="row">
2 <div class="col">
3 1 of 2
4 </div>
5 <div class="col">
6 2 of 2
7 </div>
8</div>
1<div class="container">
2 <div class="row">
3 <div class="col">
4 1 of 3
5 </div>
6 <div class="col-6">
7 2 of 3 (wider)
8 </div>
9 <div class="col">
10 3 of 3
11 </div>
12 </div>
13 <div class="row">
14 <div class="col">
15 1 of 3
16 </div>
17 <div class="col-5">
18 2 of 3 (wider)
19 </div>
20 <div class="col">
21 3 of 3
22 </div>
23 </div>
24</div>
1The above example creates three equal-width columns on small, medium, large, and extra large devices using our predefined grid classes. Those columns are centered in the page with the parent .container.
2
3Breaking it down, here’s how it works:
4
5Containers provide a means to center and horizontally pad your site’s contents. Use .container for a responsive pixel width or .container-fluid for width: 100% across all viewport and device sizes.
6Rows are wrappers for columns. Each column has horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins. This way, all the content in your columns is visually aligned down the left side.
7In a grid layout, content must be placed within columns and only columns may be immediate children of rows.
8Thanks to flexbox, grid columns without a specified width will automatically layout as equal width columns. For example, four instances of .col-sm will each automatically be 25% wide from the small breakpoint and up. See the auto-layout columns section for more examples.
9Column classes indicate the number of columns you’d like to use out of the possible 12 per row. So, if you want three equal-width columns across, you can use .col-4.
10Column widths are set in percentages, so they’re always fluid and sized relative to their parent element.
11Columns have horizontal padding to create the gutters between individual columns, however, you can remove the margin from rows and padding from columns with .no-gutters on the .row.
12To make the grid responsive, there are five grid breakpoints, one for each responsive breakpoint: all breakpoints (extra small), small, medium, large, and extra large.
13Grid breakpoints are based on minimum width media queries, meaning they apply to that one breakpoint and all those above it (e.g., .col-sm-4 applies to small, medium, large, and extra large devices, but not the first xs breakpoint).
14You can use predefined grid classes (like .col-4) or Sass mixins for more semantic markup.
15
16<div class="container">
17 <div class="row">
18 <div class="col-sm">
19 One of three columns
20 </div>
21 <div class="col-sm">
22 One of three columns
23 </div>
24 <div class="col-sm">
25 One of three columns
26 </div>
27 </div>
28</div>