Grid

THIS MONTH

$58,356

LAST MONTH

$48,356

Grid options

See how aspects of the Bootstrap grid system work across multiple devices with a handy table. check the official website grid page
xs
<576px
sm
≥576px
md
≥768px
lg
≥992px
xl
≥1200px
xxl
≥1400px
Container max-width None (auto) 540px 720px 960px 1140px 1320px
Class prefix .col- .col-sm- .col-md- .col-lg- .col-xl- .col-xxl-
# of columns 12
Gutter width 1.5rem (.75rem on left and right)
Custom gutters Yes
Nestable Yes
Column ordering Yes

Equal-width

For example, here are two grid layouts that apply to every device and viewport, from xs to xxl. Add any number of unit-less classes for each breakpoint you need and every column will be the same width.
1 of 2
2 of 2
1 of 3
2 of 3
3 of 3
                                    
                                        <div class="container">
                                          <div class="row mb-2">
                                            <div class="col bg-light py-2 px-3 border">
                                              1 of 2
                                            </div>
                                            <div class="col bg-light py-2 px-3 border">
                                              2 of 2
                                            </div>
                                          </div>
                                          <div class="row">
                                            <div class="col bg-light py-2 px-3 border">
                                              1 of 3
                                            </div>
                                            <div class="col bg-light py-2 px-3 border">
                                              2 of 3
                                            </div>
                                            <div class="col bg-light py-2 px-3 border">
                                              3 of 3
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Setting one column width

Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths. Note that the other columns will resize no matter the width of the center column.
1 of 3
2 of 3 (wider)
3 of 3
1 of 3
2 of 3 (wider)
3 of 3
                                    
                                       <div class="container">
                                          <div class="row mb-2">
                                            <div class="col bg-light py-2 px-3 border">
                                              1 of 3
                                            </div>
                                            <div class="col-6 bg-light py-2 px-3 border">
                                              2 of 3 (wider)
                                            </div>
                                            <div class="col bg-light py-2 px-3 border">
                                              3 of 3
                                            </div>
                                          </div>
                                          <div class="row">
                                            <div class="col bg-light py-2 px-3 border">
                                              1 of 3
                                            </div>
                                            <div class="col-5 bg-light py-2 px-3 border">
                                              2 of 3 (wider)
                                            </div>
                                            <div class="col bg-light py-2 px-3 border">
                                              3 of 3
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Variable width content

Use col-{breakpoint}-auto classes to size columns based on the natural width of their content.
1 of 3
Variable width content
3 of 3
1 of 3
Variable width content
3 of 3
                                    
                                       <div class="container">
                                          <div class="row justify-content-md-center mb-2">
                                            <div class="col col-lg-2 bg-light py-2 px-3 border">
                                              1 of 3
                                            </div>
                                            <div class="col-md-auto bg-light py-2 px-3 border">
                                              Variable width content
                                            </div>
                                            <div class="col col-lg-2 bg-light py-2 px-3 border">
                                              3 of 3
                                            </div>
                                          </div>
                                          <div class="row">
                                            <div class="col bg-light py-2 px-3 border">
                                              1 of 3
                                            </div>
                                            <div class="col-md-auto bg-light py-2 px-3 border">
                                              Variable width content
                                            </div>
                                            <div class="col col-lg-2 bg-light py-2 px-3 border">
                                              3 of 3
                                            </div>
                                          </div>
                                        </div>
                                    
                                

All breakpoints

For grids that are the same from the smallest of devices to the largest, use the .col and .col-* classes. Specify a numbered class when you need a particularly sized column; otherwise, feel free to stick to .col.
col
col
col
col
col-8
col-4
                                    
                                        <div class="container">
                                          <div class="row mb-2">
                                            <div class="col bg-light py-2 px-3 border">col</div>
                                            <div class="col bg-light py-2 px-3 border">col</div>
                                            <div class="col bg-light py-2 px-3 border">col</div>
                                            <div class="col bg-light py-2 px-3 border">col</div>
                                          </div>
                                          <div class="row">
                                            <div class="col-8 bg-light py-2 px-3 border">col-8</div>
                                            <div class="col-4 bg-light py-2 px-3 border">col-4</div>
                                          </div>
                                        </div>
                                    
                                

Stacked to horizontal

Using a single set of .col-sm-* classes, you can create a basic grid system that starts out stacked and becomes horizontal at the small breakpoint (sm).
col-sm-8
col-sm-4
col-sm
col-sm
col-sm
                                    
                                        <div class="container">
                                          <div class="row">
                                            <div class="col-sm-8 bg-light py-2 px-3 border">col-sm-8</div>
                                            <div class="col-sm-4 bg-light py-2 px-3 border">col-sm-4</div>
                                          </div>
                                          <div class="row">
                                            <div class="col-sm bg-light py-2 px-3 border">col-sm</div>
                                            <div class="col-sm bg-light py-2 px-3 border">col-sm</div>
                                            <div class="col-sm bg-light py-2 px-3 border">col-sm</div>
                                          </div>
                                        </div>
                                    
                                

Mix and Match

Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.
.col-md-8
.col-6 .col-md-4
.col-6 .col-md-4
.col-6 .col-md-4
.col-6 .col-md-4
.col-6
.col-6
                                    
                                        <div class="container">
                                          <!-- Stack the columns on mobile by making one full-width and the other half-width -->
                                          <div class="row">
                                            <div class="col-md-8 bg-light py-2 px-3 border">.col-md-8</div>
                                            <div class="col-6 col-md-4 bg-light py-2 px-3 border">.col-6 .col-md-4</div>
                                          </div>

                                          <!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop -->
                                          <div class="row">
                                            <div class="col-6 col-md-4 bg-light py-2 px-3 border">.col-6 .col-md-4</div>
                                            <div class="col-6 col-md-4 bg-light py-2 px-3 border">.col-6 .col-md-4</div>
                                            <div class="col-6 col-md-4 bg-light py-2 px-3 border">.col-6 .col-md-4</div>
                                          </div>

                                          <!-- Columns are always 50% wide, on mobile and desktop -->
                                          <div class="row">
                                            <div class="col-6 bg-light py-2 px-3 border">.col-6</div>
                                            <div class="col-6 bg-light py-2 px-3 border">.col-6</div>
                                          </div>
                                        </div>
                                    
                                

Row columns

Use the responsive .row-cols-* classes to quickly set the number of columns that best render your content and layout. Whereas normal .col-* classes apply to the individual columns (e.g., .col-md-4), the row columns classes are set on the parent .row as a shortcut. With .row-cols-auto you can give the columns their natural width.
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-2">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-3">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-auto">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-4">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-4">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col-6 bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                
Column
Column
Column
Column
                                    
                                        <div class="container">
                                          <div class="row row-cols-1 row-cols-sm-2 row-cols-md-4">
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                            <div class="col bg-light py-2 px-3 border">Column</div>
                                          </div>
                                        </div>
                                    
                                

Nesting

To nest your content with the default grid, add a new .row and set of .col-sm-* columns within an existing .col-sm-* column. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).
Level 1: .col-sm-3
Level 2: .col-8 .col-sm-6
Level 2: .col-4 .col-sm-6
                                    
                                        <div class="container">
                                          <div class="row">
                                            <div class="col-sm-3 bg-light py-2 px-3 border">
                                              Level 1: .col-sm-3
                                            </div>
                                            <div class="col-sm-9 bg-light py-2 px-3 border">
                                              <div class="row">
                                                <div class="col-8 col-sm-6 bg-light py-2 px-3 border">
                                                  Level 2: .col-8 .col-sm-6
                                                </div>
                                                <div class="col-4 col-sm-6 bg-light py-2 px-3 border">
                                                  Level 2: .col-4 .col-sm-6
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Column - Vertical Alignment

Use flexbox alignment utilities to vertically and horizontally align columns.
One of three columns
One of three columns
One of three columns
One of three columns
One of three columns
One of three columns
One of three columns
One of three columns
One of three columns
                                    
                                        <div class="container">
                                          <div class="row align-items-start bg-light mb-3" style="min-height: 150px;">
                                            <div class="col border-top border-bottom border-start py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-start border-end border py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-end py-2 px-3">
                                              One of three columns
                                            </div>
                                          </div>
                                          <div class="row align-items-center bg-light mb-3" style="min-height: 150px;">
                                            <div class="col border-top border-bottom border-start py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-start border-end border py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-end py-2 px-3">
                                              One of three columns
                                            </div>
                                          </div>
                                          <div class="row align-items-end bg-light mb-3" style="min-height: 150px;">
                                            <div class="col border-top border-bottom border-start py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-start border-end border py-2 px-3">
                                              One of three columns
                                            </div>
                                            <div class="col border-top border-bottom border-end py-2 px-3">
                                              One of three columns
                                            </div>
                                          </div>
                                        </div>
                                    
                                
One of three columns
One of three columns
One of three columns
                                    
                                        <div class="mt-4 container">
                                            <div class="row align-items-end bg-light mb-3" style="min-height: 150px;">
                                                <div class="col py-2 px-3 bg-light border align-self-start">
                                                  One of three columns
                                                </div>
                                                <div class="col py-2 px-3 bg-light border align-self-center">
                                                  One of three columns
                                                </div>
                                                <div class="col py-2 px-3 bg-light border align-self-end">
                                                  One of three columns
                                                </div>
                                            </div>
                                        </div>
                                    
                                

Horizontal alignment

One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
One of two columns
                                    
                                       <div class="container">
                                          <div class="row justify-content-start mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                          <div class="row justify-content-center mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                          <div class="row justify-content-end mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                          <div class="row justify-content-around mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                          <div class="row justify-content-between mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                          <div class="row justify-content-evenly mb-3">
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                            <div class="col-4 bg-light border py-2 px-3">
                                              One of two columns
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Column wrapping

.col-9
.col-4
Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.
.col-6
Subsequent columns continue along the new line.
                                    
                                       <div class="container">
                                          <div class="row">
                                            <div class="col-9 bg-light py-2 px-3 border">.col-9</div>
                                            <div class="col-4 bg-light py-2 px-3 border">.col-4<br>Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.</div>
                                            <div class="col-6 bg-light py-2 px-3 border">.col-6<br>Subsequent columns continue along the new line.</div>
                                          </div>
                                        </div>
                                    
                                

Column breaks

.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
                                    
                                       <div class="container">
                                          <div class="row">
                                            <div class="col-6 col-sm-3 bg-light border py-2 px-3">.col-6 .col-sm-3</div>
                                            <div class="col-6 col-sm-3 bg-light border py-2 px-3">.col-6 .col-sm-3</div>

                                            <!-- Force next columns to break to new line -->
                                            <div class="w-100"></div>

                                            <div class="col-6 col-sm-3 bg-light border py-2 px-3">.col-6 .col-sm-3</div>
                                            <div class="col-6 col-sm-3 bg-light border py-2 px-3">.col-6 .col-sm-3</div>
                                          </div>
                                        </div>
                                    
                                

Reording - Order classes

Use .order- classes for controlling the visual order of your content. These classes are responsive, so you can set the order by breakpoint (e.g., .order-1.order-md-2). Includes support for 1 through 5 across all six grid tiers.
First in DOM, no order applied
Second in DOM, with a larger order
Third in DOM, with an order of 1
                                    
                                       <div class="container">
                                          <div class="row">
                                            <div class="col bg-light border py-2 px-3">
                                              First in DOM, no order applied
                                            </div>
                                            <div class="col order-5 bg-light border py-2 px-3">
                                              Second in DOM, with a larger order
                                            </div>
                                            <div class="col order-1 bg-light border py-2 px-3">
                                              Third in DOM, with an order of 1
                                            </div>
                                          </div>
                                        </div>
                                    
                                
First in DOM, no order applied
Second in DOM, with a larger order
Third in DOM, with an order of 1
                                    
                                       <div class="container mt-4">
                                          <div class="row">
                                            <div class="col order-last bg-light border py-2 px-3">
                                              First in DOM, no order applied
                                            </div>
                                            <div class="col bg-light border py-2 px-3">
                                              Second in DOM, with a larger order
                                            </div>
                                            <div class="col order-first bg-light border py-2 px-3">
                                              Third in DOM, with an order of 1
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Offset column classes

Move columns to the right using .offset-md-* classes. These classes increase the left margin of a column by * columns. For example, .offset-md-4 moves .col-md-4 over four columns.
.col-md-4
.col-md-4 .offset-md-4
.col-md-3 .offset-md-3
.col-md-3 .offset-md-3
.col-md-6 .offset-md-3
                                    
                                       <div class="container">
                                          <div class="row">
                                            <div class="col-md-4 bg-light py-2 px-3 border">.col-md-4</div>
                                            <div class="col-md-4 offset-md-4 bg-light py-2 px-3 border">.col-md-4 .offset-md-4</div>
                                          </div>
                                          <div class="row mt-3">
                                            <div class="col-md-3 offset-md-3 bg-light py-2 px-3 border">.col-md-3 .offset-md-3</div>
                                            <div class="col-md-3 offset-md-3 bg-light py-2 px-3 border">.col-md-3 .offset-md-3</div>
                                          </div>
                                          <div class="row mt-3">
                                            <div class="col-md-6 offset-md-3 bg-light py-2 px-3 border">.col-md-6 .offset-md-3</div>
                                          </div>
                                        </div>
                                    
                                

Standalone column classes

The .col-* classes can also be used outside a .row to give an element a specific width. Whenever column classes are used as non direct children of a row, the paddings are omitted.
.col-3: width of 25%
.col-sm-9: width of 75% above sm breakpoint
                                    
                                       <div class="col-3 bg-light p-3 border">
                                          .col-3: width of 25%
                                        </div>
                                        <div class="col-sm-9 bg-light p-3 border">
                                          .col-sm-9: width of 75% above sm breakpoint
                                        </div>
                                    
                                

Gutters - Horizontal

.gx-* classes can be used to control the horizontal gutter widths. The .container or .container-fluid parent may need to be adjusted if larger gutters are used too to avoid unwanted overflow, using a matching padding utility. For example, in the following example we’ve increased the padding with .px-4:
Custom column padding
Custom column padding
                                    
                                       <div class="container px-4">
                                          <div class="row gx-5">
                                            <div class="col">
                                             <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Gutters - Vertical

.gy-* classes can be used to control the vertical gutter widths. Like the horizontal gutters, the vertical gutters can cause some overflow below the .row at the end of a page. If this occurs, you add a wrapper around .row with the .overflow-hidden class:
Custom column padding
Custom column padding
Custom column padding
Custom column padding
                                    
                                       <div class="container overflow-hidden">
                                          <div class="row gy-5">
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Gutters - Vertical & Horizontal

.g-* classes can be used to control the horizontal gutter widths, for the following example we use a smaller gutter width, so there won’t be a need to add the .overflow-hidden wrapper class.
Custom column padding
Custom column padding
Custom column padding
Custom column padding
                                    
                                       <div class="container">
                                          <div class="row g-2">
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                            <div class="col-6">
                                              <div class="p-3 border bg-light">Custom column padding</div>
                                            </div>
                                          </div>
                                        </div>
                                    
                                

Row columns gutters

Gutter classes can also be added to row columns. In the following example, we use responsive row columns and responsive gutter classes.
Row column
Row column
Row column
Row column
Row column
Row column
Row column
Row column
Row column
Row column
                                    
                                       <div class="container">
                                          <div class="row row-cols-2 row-cols-lg-5 g-2 g-lg-3">
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                            <div class="col">
                                              <div class="p-3 border bg-light">Row column</div>
                                            </div>
                                          </div>
                                        </div>
                                    
                                

No gutters

The gutters between columns in our predefined grid classes can be removed with .g-0. This removes the negative margins from .row and the horizontal padding from all immediate children columns.
.col-sm-6 .col-md-8
.col-6 .col-md-4
                                    
                                       <div class="row g-0">
                                          <div class="col-sm-6 col-md-8 p-3 bg-light border">.col-sm-6 .col-md-8</div>
                                          <div class="col-6 col-md-4 p-3 bg-light border">.col-6 .col-md-4</div>
                                        </div>
                                    
                                
All Rights Reserved by Materialpro admin.