Content

Grid options

Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example and an in-depth look at how the grid comes together.

While Bootstrap uses ems or rems for defining most sizes, pxs are used for grid breakpoints and container widths. This is because the viewport width is in pixels and does not change with the font size.

See how aspects of the Bootstrap grid system work across multiple devices with a handy table.

Extra small
<576px
Small
≥576px
Medium
≥768px
Large
≥992px
Extra large
≥1200px
Max container width None (auto) 540px 720px 960px 1140px
Class prefix .col- .col-sm- .col-md- .col-lg- .col-xl-
# of columns 12
Gutter width 30px (15px on each side of a column)
Nestable Yes
Column ordering Yes

Auto-layout columns

Utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class like .col-sm-6.

Equal-width

For example, here are two grid layouts that apply to every device and viewport, from xs to xl. 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">
                                        <div class="col">
                                          1 of 2
                                        </div>
                                        <div class="col">
                                          2 of 2
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col">
                                          1 of 3
                                        </div>
                                        <div class="col">
                                          2 of 3
                                        </div>
                                        <div class="col">
                                          3 of 3
                                        </div>
                                      </div>
                                    </div>
                                
                            

Equal-width columns can be broken into multiple lines, but there was a Safari flexbox bug that prevented this from working without an explicit flex-basis or border.

Two workarounds have been documented in a reduced test case outside Bootstrap, though if the browser is up to date this shouldn’t be necessary.

Column
Column
Column
Column
                                
                                <div class="container">
                                  <div class="row">
                                    <div class="col">Column</div>
                                    <div class="col">Column</div>
                                    <div class="w-100"></div>
                                    <div class="col">Column</div>
                                    <div class="col">Column</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">
                                        <div class="col">
                                          1 of 3
                                        </div>
                                        <div class="col-6">
                                          2 of 3 (wider)
                                        </div>
                                        <div class="col">
                                          3 of 3
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col">
                                          1 of 3
                                        </div>
                                        <div class="col-5">
                                          2 of 3 (wider)
                                        </div>
                                        <div class="col">
                                          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">
                                        <div class="col col-lg-2">
                                          1 of 3
                                        </div>
                                        <div class="col-md-auto">
                                          Variable width content
                                        </div>
                                        <div class="col col-lg-2">
                                          3 of 3
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col">
                                          1 of 3
                                        </div>
                                        <div class="col-md-auto">
                                          Variable width content
                                        </div>
                                        <div class="col col-lg-2">
                                          3 of 3
                                        </div>
                                      </div>
                                    </div>
                                
                            

Equal-width multi-row

Create equal-width columns that span multiple rows by inserting a .w-100 where you want the columns to break to a new line. Make the breaks responsive by mixing the .w-100 with some responsive display utilities.

col
col
col
col
                                
                                <div class="row">
                                  <div class="col">col</div>
                                  <div class="col">col</div>
                                  <div class="w-100"></div>
                                  <div class="col">col</div>
                                  <div class="col">col</div>
                                </div>
                                
                            

Responsive classes

Bootstrap’s grid includes five tiers of predefined classes for building complex responsive layouts. Customize the size of your columns on extra small, small, medium, large, or extra large devices however you see fit.

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="row">
                                      <div class="col">col</div>
                                      <div class="col">col</div>
                                      <div class="col">col</div>
                                      <div class="col">col</div>
                                    </div>
                                    <div class="row">
                                      <div class="col-8">col-8</div>
                                      <div class="col-4">col-4</div>
                                    </div>
                                
                            

Stacked to horizontal

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-12 .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
                                
                                <!-- Modern the columns on mobile by making one full-width and the other half-width -->
                                <div class="row">
                                  <div class="col-12 col-md-8">.col-12 .col-md-8</div>
                                  <div class="col-6 col-md-4">.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">.col-6 .col-md-4</div>
                                  <div class="col-6 col-md-4">.col-6 .col-md-4</div>
                                  <div class="col-6 col-md-4">.col-6 .col-md-4</div>
                                </div>
                                
                                <!-- Columns are always 50% wide, on mobile and desktop -->
                                <div class="row">
                                  <div class="col-6">.col-6</div>
                                  <div class="col-6">.col-6</div>
                                </div>
                                
                            

Alignment

Use flexbox alignment utilities to vertically and horizontally align columns.

Vertical alignment

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">
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                  </div>
                                  <div class="row align-items-center">
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                  </div>
                                  <div class="row align-items-end">
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                    <div class="col">
                                      One of three columns
                                    </div>
                                  </div>
                                </div>
                                
                            
One of three columns
One of three columns
One of three columns

                                <div class="container">
                                  <div class="row">
                                    <div class="col align-self-start">
                                      One of three columns
                                    </div>
                                    <div class="col align-self-center">
                                      One of three columns
                                    </div>
                                    <div class="col 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
                                
                                    <div class="container">
                                      <div class="row justify-content-start">
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                      </div>
                                      <div class="row justify-content-center">
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                      </div>
                                      <div class="row justify-content-end">
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                      </div>
                                      <div class="row justify-content-around">
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                      </div>
                                      <div class="row justify-content-between">
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                        <div class="col-4">
                                          One of two columns
                                        </div>
                                      </div>
                                    </div>
                                
                            

No gutters

The gutters between columns in our predefined grid classes can be removed with .no-gutters. This removes the negative margins from .row and the horizontal padding from all immediate children columns.

Here’s the source code for creating these styles. Note that column overrides are scoped to only the first children columns and are targeted via attribute selector. While this generates a more specific selector, column padding can still be further customized with spacing utilities.

Need an edge-to-edge design? Drop the parent .container or .container-fluid.

                                
                                    .no-gutters {
                                      margin-right: 0;
                                      margin-left: 0;
                                    
                                      > .col,
                                      > [class*="col-"] {
                                        padding-right: 0;
                                        padding-left: 0;
                                      }
                                    }
                                
                            

In practice, here’s how it looks. Note you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders, and more).

.col-12 .col-sm-6 .col-md-8
.col-6 .col-md-4
                                
                                    <div class="row no-gutters">
                                      <div class="col-12 col-sm-6 col-md-8">.col-12 .col-sm-6 .col-md-8</div>
                                      <div class="col-6 col-md-4">.col-6 .col-md-4</div>
                                    </div>
                                
                            

Column wrapping

If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line.

.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="row">
                                      <div class="col-9">.col-9</div>
                                      <div class="col-4">.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">.col-6<br>Subsequent columns continue along the new line.</div>
                                    </div>
                                
                            

Column breaks

Breaking columns to a new line in flexbox requires a small hack: add an element with width: 100% wherever you want to wrap your columns to a new line. Normally this is accomplished with multiple .rows, but not ever implementation method can account for this.

.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
                                
                                    <div class="row">
                                      <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
                                      <div class="col-6 col-sm-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">.col-6 .col-sm-3</div>
                                      <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
                                    </div>
                                
                            

You may also apply this break at specific breakpoints with our responsive display utilities.

.col-6 .col-sm-4
.col-6 .col-sm-4
.col-6 .col-sm-4
.col-6 .col-sm-4
                                
                                <div class="row">
                                  <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
                                  <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
                                
                                  <!-- Force next columns to break to new line at md breakpoint and up -->
                                  <div class="w-100 d-none d-md-block"></div>
                                
                                  <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
                                  <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
                                </div>
                                
                            

Reordering

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 12 across all five grid tiers.

First, but unordered
Second, but last
Third, but first
                                
                                    <div class="container">
                                      <div class="row">
                                        <div class="col">
                                          First, but unordered
                                        </div>
                                        <div class="col order-12">
                                          Second, but last
                                        </div>
                                        <div class="col order-1">
                                          Third, but first
                                        </div>
                                      </div>
                                    </div>
                                
                            

There’s also a responsive .order-first class that quickly changes the order of one element by applying order: -1. This class can also be intermixed with the numbered .order-* classes as needed.

First, but unordered
Second, but unordered
Third, but first
                                
                                    <div class="container">
                                      <div class="row">
                                        <div class="col">
                                          First, but unordered
                                        </div>
                                        <div class="col">
                                          Second, but unordered
                                        </div>
                                        <div class="col order-first">
                                          Third, but first
                                        </div>
                                      </div>
                                    </div>
                                
                            

Offsetting columns

You can offset grid columns in two ways: our responsive .offset- grid classes and our margin utilities. Grid classes are sized to match columns while margins are more useful for quick layouts where the width of the offset is variable.

Offset 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="row">
                                      <div class="col-md-4">.col-md-4</div>
                                      <div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
                                    </div>
                                    <div class="row">
                                      <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
                                      <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
                                    </div>
                                    <div class="row">
                                      <div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
                                    </div>
                                
                            

In addition to column clearing at responsive breakpoints, you may need to reset offsets. See this in action in the grid example.

.col-sm-5 .col-md-6
.col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0
.col.col-sm-6.col-md-5.col-lg-6
.col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0
                                
                                    <div class="row">
                                      <div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div>
                                      <div class="col-sm-5 offset-sm-2 col-md-6 offset-md-0">.col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0</div>
                                    </div>
                                    
                                    <div class="row">
                                      <div class="col-sm-6 col-md-5 col-lg-6">.col.col-sm-6.col-md-5.col-lg-6</div>
                                      <div class="col-sm-6 col-md-5 offset-md-2 col-lg-6 offset-lg-0">.col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0</div>
                                    </div>
                                
                            

Margin utilities

With the move to flexbox in v4, you can use margin utilities like .mr-auto to force sibling columns away from one another.

.col-md-4
.col-md-4 .ml-auto
.col-md-3 .ml-md-auto
.col-md-3 .ml-md-auto
.col-auto .mr-auto
.col-auto
                                
                                    <div class="row">
                                      <div class="col-md-4">.col-md-4</div>
                                      <div class="col-md-4 ml-auto">.col-md-4 .ml-auto</div>
                                    </div>
                                    <div class="row">
                                      <div class="col-md-3 ml-md-auto">.col-md-3 .ml-md-auto</div>
                                      <div class="col-md-3 ml-md-auto">.col-md-3 .ml-md-auto</div>
                                    </div>
                                    <div class="row">
                                      <div class="col-auto mr-auto">.col-auto .mr-auto</div>
                                      <div class="col-auto">.col-auto</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-9
Level 2: .col-8 .col-sm-6
Level 2: .col-4 .col-sm-6
                                
                                    <div class="row">
                                      <div class="col-sm-9">
                                        Level 1: .col-sm-9
                                        <div class="row">
                                          <div class="col-8 col-sm-6">
                                            Level 2: .col-8 .col-sm-6
                                          </div>
                                          <div class="col-4 col-sm-6">
                                            Level 2: .col-4 .col-sm-6
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                
                            

Text Utilities


Contextual colors

Convey meaning through color with a handful of emphasis utility classes. These may also be applied to links and will darken on hover just like our default link styles.

Example Classes Snippet

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

.text-muted
                              
                                <p class="text-muted">Your Text.</p>
                              
                            

Nullam id dolor id nibh ultricies vehicula ut id elit.

.text-primary
                              
                                <p class="text-primary">Your Text.</p>
                              
                            

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

.text-success
                              
                                <p class="text-success">Your Text.</p>
                              
                            

Maecenas sed diam eget risus varius blandit sit amet non magna.

.text-info
                              
                                <p class="text-info">Your Text.</p>
                              
                            

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

.text-warning
                              
                                <p class="text-warning">Your Text.</p>
                              
                            

Donec ullamcorper nulla non metus auctor fringilla.

.text-danger
                              
                                <p class="text-danger">Your Text.</p>
                              
                            

Modern Admin also provide custom color palette for the text, below table show you usage.

You can also use text lighten, darken and accent classes.

  • li.red .lighten-* For lighten red text color, this two classes needed. Here *: 1,2,3,4 for lighten red color options.
  • .red .darken-* For darken red text color, this two classes needed. Here *: 1,2,3,4 for darken red color options.
  • .red .accent-* For accent red text color, this two classes needed. Here *: 1,2,3,4 for accent red color options.
Example Classes Snippet

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

.red
                              
                                <p class="red">Your Text.</p>
                              
                            

Nullam id dolor id nibh ultricies vehicula ut id elit.

.purple
                              
                                <p class="purple">Your Text.</p>
                              
                            

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

.indigo
                              
                                <p class="indigo">Your Text.</p>
                              
                            

Maecenas sed diam eget risus varius blandit sit amet non magna.

.light-blue
                              
                                <p class="light-blue">Your Text.</p>
                              
                            

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

.teal
                              
                                <p class="teal">Your Text.</p>
                              
                            

Donec ullamcorper nulla non metus auctor fringilla.

.blue-grey
                              
                                <p class="blue-grey">Your Text.</p>
                              
                            

Contextual background

Contextual text color classes, easily set the background of an element to any contextual class. Anchor components will darken on hover, just like the text classes.

Example Classes Snippet
Nullam id dolor id nibh ultricies vehicula ut id elit. .bg-primary
                              
                                <p class="bg-primary">Your Text.</p>
                              
                            
Duis mollis, est non commodo luctus, nisi erat porttitor ligula. .bg-success
                              
                                <p class="bg-success">Your Text.</p>
                              
                            
Maecenas sed diam eget risus varius blandit sit amet non magna. .bg-info
                              
                                <p class="bg-info">Your Text.</p>
                              
                            
Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh. .bg-warning
                              
                                <p class="bg-warning">Your Text.</p>
                              
                            
Donec ullamcorper nulla non metus auctor fringilla. .bg-danger
                              
                                <p class="bg-danger">Your Text.</p>
                              
                            
Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh. .bg-dark
                              
                                <p class="bg-dark">Your Text.</p>
                              
                            

Modern Admin also provide custom color palette for the background colors, below table show you usage.

You can also use background lighten, darken and accent classes.

  • .bg-red .bg-lighten-* For lighten red text color, this two classes needed. Here *: 1,2,3,4 for lighten red color options.
  • .bg-red .bg-darken-* For darken red text color, this two classes needed. Here *: 1,2,3,4 for darken red color options.
  • .bg-red .bg-accent-* For accent red text color, this two classes needed. Here *: 1,2,3,4 for accent red color options.
Example Classes Snippet
Fusce dapibus, tellus ac cursus commodo. .bg-red
                              
                                <p class="bg-red bg-dark">Your Text.</p>
                              
                            
Nullam id dolor id nibh ultricies. .purple
                              
                                <p class="bg-purple bg-dark">Your Text.</p>
                              
                            
Duis mollis, est non commodo luctus, nisi erat. .bg-indigo
                              
                                <p class="bg-indigo bg-dark">Your Text.</p>
                              
                            
Maecenas sed diam eget risus varius blandit sit. .bg-light-blue
                              
                                <p class="bg-light-blue bg-dark">Your Text.</p>
                              
                            
Fusce dapibus, tellus ac cursus commodo. .bg-teal
                              
                                <p class="bg-teal bg-dark">Your Text.</p>
                              
                            
Donec ullamcorper nulla non metus. .blue-grey
                              
                                <p class="blue-grey bg-dark">Your Text.</p>
                              
                            

Text alignment

Easily realign text to components with text alignment classes.

Example Classes Snippet

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

.text-justify
                              
                                <p class="text-justify">Justified text.</p>
                              
                            

It is a long established fact that a reader.

.text-nowrap
                              
                                <p class="text-nowrap">No wrap text.</p>
                              
                            

For left, right, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.

Example Classes Snippet

Left aligned text on all viewport sizes.

.text-left
                              
                                <p class="text-left">Left aligned text on all viewport sizes.</p>
                              
                            

Center aligned text on all viewport sizes.

.text-center
                              
                                <p class="text-center">Center aligned text on all viewport sizes.</p>
                              
                            

Right aligned text on all viewport sizes.

.text-right
                              
                                <p class="text-right">Right aligned text on all viewport sizes.</p>
                              
                            

Left aligned text on viewports sized SM or wider.

Left aligned text on viewports sized MD or wider.

Left aligned text on viewports sized LG or wider.

Left aligned text on viewports sized XL or wider.

.text-sm-left .text-md-left .text-lg-left .text-xl-left
                              
                                <p class="text-sm-left">Left aligned text on viewports sized SM or wider.</p>
                                <p class="text-md-left">Left aligned text on viewports sized MD or wider.</p>
                                <p class="text-lg-left">Left aligned text on viewports sized LG or wider.</p>
                                <p class="text-xl-left">Left aligned text on viewports sized XL or wider.</p>
                              
                            

Center aligned text on viewports sized SM or wider.

Center aligned text on viewports sized MD or wider.

Center aligned text on viewports sized LG or wider.

Center aligned text on viewports sized XL or wider.

.text-sm-center .text-md-center .text-lg-center .text-xl-center
                              
                                <p class="text-sm-center">Center aligned text on viewports sized SM or wider.</p>
                                <p class="text-md-center">Center aligned text on viewports sized MD or wider.</p>
                                <p class="text-lg-center">Center aligned text on viewports sized LG or wider.</p>
                                <p class="text-xl-center">Center aligned text on viewports sized XL or wider.</p>
                              
                            

Right aligned text on viewports sized SM or wider.

Right aligned text on viewports sized MD or wider.

Right aligned text on viewports sized LG or wider.

Right aligned text on viewports sized XL or wider.

.text-sm-right .text-md-right .text-lg-right .text-xl-right
                              
                                <p class="text-sm-right">Right aligned text on viewports sized SM or wider.</p>
                                <p class="text-md-right">Right aligned text on viewports sized MD or wider.</p>
                                <p class="text-lg-right">Right aligned text on viewports sized LG or wider.</p>
                                <p class="text-xl-right">Right aligned text on viewports sized XL or wider.</p>
                              
                            

Text transform

Transform text in components with text capitalization classes.

Note how text-capitalize only changes the first letter of each word, leaving the case of any other letters unaffected.

Example Classes Snippet

Lowercased text.

.text-lowercase
                              
                                <p class="text-lowercase">Lowercased text.</p>
                              
                            

Uppercased text.

.text-uppercase
                              
                                <p class="text-uppercase">Uppercased text.</p>
                              
                            

CapiTaliZed text.

.text-uppercase
                              
                                <p class="text-capitalize">CapiTaliZed text.</p>
                              
                            

Text option

Font size

Modern Admin provide font large & small sizes variant classes to change font size.

Example Classes Snippet

Large lg text size.

.font-medium-3
                              
                                <p class="font-medium-3" >Large lg text size.</p>
                              
                            

Large md text size.

.font-medium-2
                              
                                <p class="font-medium-2" >Large md text size.</p>
                              
                            

Large sm text size.

.font-medium-1
                              
                                <p class="font-medium-1" >Large sm text size.</p>
                              
                            

Normal base text size.

N/A
                              
                                <p>Normal base text size.</p>
                              
                            

Small lg text size.

.font-small-3
                              
                                <p class="font-small-3" >Small lg text size.</p>
                              
                            

Small md text size.

.font-small-2
                              
                                <p class="font-small-2" >Small md text size.</p>
                              
                            

Small sm text size.

.font-small-1
                              
                                <p class="font-small-1" >Small sm text size.</p>
                              
                            
Font weight

Modern Admin provide font weight class .text-bold-{weight}, where {weight} value can be 100,200 ... 900.

Example Classes Snippet

Font weight 100

.text-bold-100
                              
                                <p class="text-bold-100">Font weight 100.</p>
                              
                            

Font weight 200

.text-bold-200
                              
                                <p class="text-bold-200">Font weight 200.</p>
                              
                            

Font weight 300

.text-bold-300
                              
                                <p class="text-bold-300">Font weight 300.</p>
                              
                            

Font weight 400

.text-bold-400
                              
                                <p class="text-bold-400">Font weight 400.</p>
                              
                            

Font weight 500

.text-bold-500
                              
                                <p class="text-bold-500">Font weight 500.</p>
                              
                            

Font weight 600

.text-bold-600
                              
                                <p class="text-bold-600">Font weight 600.</p>
                              
                            

Font weight 700

.text-bold-700
                              
                                <p class="text-bold-700">Font weight 700.</p>
                              
                            

Font weight 800

.text-bold-800
                              
                                <p class="text-bold-800">Font weight 800.</p>
                              
                            

Font weight 900

.text-bold-900
                              
                                <p class="text-bold-900">Font weight 900.</p>
                              
                            
Inline text elements

Styling for common inline HTML5 elements.

.mark and .small classes are also available to apply the same styles as <mark> and <small> while avoiding any unwanted semantic implications that the tags would bring.

While not shown above, feel free to use <b> and <i> in HTML5. <b> is meant to highlight words or phrases without conveying additional importance while <i> is mostly for voice, technical terms, etc.

Example Snippet

You can use the mark tag to highlight text.

                              
                                <p>You can use the mark tag to <mark>highlight</mark> text.</p>
                              
                            

This line of text is meant to be treated as deleted text.

                              
                                <p><del>This line of text is meant to be treated as deleted text.</del></p>
                              
                            

This line of text is meant to be treated as no longer accurate.

                              
                                <p><s>This line of text is meant to be treated as no longer accurate.</s></p>
                              
                            

This line of text is meant to be treated as an addition to the document.

                              
                                <p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
                              
                            

This line of text will render as underlined

                              
                                <p><u>This line of text will render as underlined.</u></p>
                              
                            

This line of text is meant to be treated as fine print.

                              
                                <p><small>This line of text is meant to be treated as fine print.</small></p>
                              
                            

This line rendered as bold text.

                              
                                <p><strong>This line rendered as bold text.</strong></p>
                              
                            

This line rendered as italicized text.

                              
                                <p><em>This line rendered as italicized text.</em></p>
                              
                            

Sample abbreviation

                              
                                <p> Sample <abbr>Abbreviations.</abbr></p>
                              
                            

Sample HTML title.

                              
                                <p> Sample <abbr title="HyperText Markup Language" class="initialism">HTML.</abbr></p>
                              
                            
y = m x + b
                              
                                <p> For indicating variables use the <var> tag.</p>
                              
                            

Edit settings, press ctrl + ,

                              
                                <p> Use the <kbd>  to indicate input that is typically entered via keyboard.</p>
                              
                            
This text is meant to be treated as sample output from a computer program.
                              
                                <p> For indicating sample output from a program use the  <samp>  tag. </p>
                              
                            
Inline code snippet
                              
                                <p> Wrap inline snippets of code with <code> tag. </p>
                              
                            

Borders

Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.

Add border

Add one of these to class to add border on the required side.

Classes Description
.border Add solid border of 1px on each side.
.border-top Add solid border top of 1px.
.border-bottom Add solid border bottom of 1px.
.border-left Add solid border left of 1px.
.border-right Add solid border right of 1px.
Remove border

Add one of these to class to remove border on the required side.

Classes Description
.no-border Remove border from all side.
.border-top-0 Remove border from the top side.
.border-bottom-0 Remove border from the bottom side.
.border-left-0 Remove border from the left side.
.border-right-0 Remove border from the right side.
Border widths

Add one of these to class to change border width on the required side.

Classes Description
.border-2 Chande border width to 2px on each side.
.border-top-2 Chande border width to 2px on top side.
.border-bottom-2 Chande border width to 2px on bottom side.
.border-left-2 Chande border width to 2px on left side.
.border-right-2 Chande border width to 2px on right side.
.border-3 Chande border width to 3px on each side.
.border-top-3 Chande border width to 3px on top side.
.border-bottom-3 Chande border width to 3px on bottom side.
.border-left-3 Chande border width to 3px on left side.
.border-right-3 Chande border width to 3px on right side.
Border color

Change the border color using utilities built on our theme colors. For more border color related options please check color palette pages.

Classes Description
.border border-primary Add primary color border to all side.
.border border-secondary Add secondary color border to all side.
.border border-success Add success color border to all side.
.border border-danger Add danger color border to all side.
.border border-warning Add warning color border to all side.
.border border-info Add info color border to all side.
.border border-light Add light color border to all side.
.border border-dark Add dark color border to all side.
.border border-white Add white color border to all side.
Border-radius

Add classes to an element to easily round its corners.

Classes Description
.rounded Add round corners border to all side.
.rounded-top Add round corners border to top side only.
.rounded-bottom Add round corners border to bottom side only.
.rounded-left Add round corners border to left side only.
.rounded-right Add round corners border to right side only.
.rounded-circle Create round circle border.
.rounded-0 Remove border corder from the all side.
Remove border radius

Add one of these to class to remove border radius on the required side.

Classes Description
.no-border-top-radius Remove border radius from top side.
.no-border-bottom-radius Remove border radius from bottom side.
.no-border-top-left-radius Remove border radius from top left side.
.no-border-top-right-radius Remove border radius from top right side.
.no-border-bottom-left-radius Remove border radius from bottom left side.
.no-border-bottom-right-radius Remove border radius from bottom right side.

Clearfix

Quickly and easily clear floated content within a container by adding a clearfix utility.

Easily clear floats by adding .clearfix to the parent element. Can also be used as a mixin.

                    
                        <div class="clearfix">...</div>
                    
                
                    
                        // Mixin itself
                        @mixin clearfix() {
                          &::after {
                            display: block;
                            content: "";
                            clear: both;
                          }
                        }
                        
                        // Usage as a mixin
                        .element {
                          @include clearfix;
                        };
                    
                

The following example shows how the clearfix can be used. Without the clearfix the wrapping div would not span around the buttons which would cause a broken layout.


                <div class="bg-info clearfix">
                  <button type="button" class="btn btn-secondary float-left">Example Button floated left</button>
                  <button type="button" class="btn btn-secondary float-right">Example Button floated right</button>
                </div>
                

Close icon

Use a generic close icon for dismissing content like modals and alerts.

Be sure to include text for screen readers, as we’ve done with aria-label.

                    
                        <button type="button" class="close" aria-label="Close">
                          <span aria-hidden="true">×</span>
                        </button>
                    
                

Display property

Quickly and responsively toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing.

Common display values

The display property accepts a handful of values and we support many of them with utility classes. We purposefully don’t provide every value as a utility, so here’s what we support:

Classes Description
.d-none Forces the element to hide on all viewports.
.d-inline Forces the element to behave like an inline element.
.d-inline-block Forces the element to behave like an inline-block element.
.d-block Forces the element to behave like an block element.
.d-table Forces the element to behave like <table> element.
.d-table-cell Forces the element to behave like <td> element.
.d-flex Forces the element as a block-level flex container.
.d-inline-flex Forces the element as an inline-level flex container.

Put them to use by applying any of the classes to an element of your choice. For example, here’s how you could use the inline, block, or inline-block utilities (the same applies to the other classes).

d-inline
d-inline

                    <div class="d-inline bg-success">d-inline</div>
                    <div class="d-inline bg-success">d-inline</div>
                    
d-block

                    <span class="d-block bg-primary">d-block</span>
                    
d-inline-block
d-inline-block

                    <div class="d-inline-block bg-warning">d-inline-block</div>
                    <div class="d-inline-block bg-warning">d-inline-block</div>
                    

Responsive variations also exist for every single utility mentioned above.

  • .d-none
  • .d-inline
  • .d-inline-block
  • .d-block
  • .d-table
  • .d-table-cell
  • .d-flex
  • .d-inline-flex
  • .d-sm-none
  • .d-sm-inline
  • .d-sm-inline-block
  • .d-sm-block
  • .d-sm-table
  • .d-sm-table-cell
  • .d-sm-flex
  • .d-sm-inline-flex
  • .d-md-none
  • .d-md-inline
  • .d-md-inline-block
  • .d-md-block
  • .d-md-table
  • .d-md-table-cell
  • .d-md-flex
  • .d-md-inline-flex
  • .d-lg-none
  • .d-lg-inline
  • .d-lg-inline-block
  • .d-lg-block
  • .d-lg-table
  • .d-lg-table-cell
  • .d-lg-flex
  • .d-lg-inline-flex
  • .d-xl-none
  • .d-xl-inline
  • .d-xl-inline-block
  • .d-xl-block
  • .d-xl-table
  • .d-xl-table-cell
  • .d-xl-flex
  • .d-xl-inline-flex
Hiding Elements

For faster mobile-friendly development, use responsive display classes for showing and hiding elements by device. Avoid creating entirely different versions of the same site, instead hide element responsively for each screen size.

To hide elements simply use the .d-none class or one of the .d-{sm,md,lg,xl}-none classes for any responsive screen variation.

To show an element only on a given interval of screen sizes you can combine one .d-*-none class with a .d-*-* class, for example .d-none.d-md-block.d-xl-none will hide the element for all screen sizes except on medium and large devices.

Screen Size Class
Hidden on all d-none
Hidden only on xs d-none d-sm-block
Hidden only on sm d-sm-none d-md-block
Hidden only on md d-md-none d-lg-block
Hidden only on lg d-lg-none d-xl-block
Hidden only on xl d-xl-none
Visible on all d-block
Visible only on xs d-block d-sm-none
Visible only on sm d-none d-sm-block d-md-none
Visible only on md d-none d-md-block d-lg-none
Visible only on lg d-none d-lg-block d-xl-none
Visible only on xl d-none d-xl-block
Display in print

Change the display value of elements when printing with our print display utilities.

Class Print style
.d-print-block Applies display: block to the element when printing
.d-print-inline Applies display: inline to the element when printing
.d-print-inline-block Applies display: inline-block to the element when printing
.d-print-none Applies display: none to the element when printing

Embeds

Create responsive video or slideshow embeds based on the width of the parent by creating an intrinsic ratio that scales on any device.

Rules are directly applied to <iframe>, <embed>, <video>, and <object> elements; optionally use an explicit descendant class .embed-responsive-item when you want to match the styling for other attributes.

Pro-Tip! You don’t need to include frameborder="0" in your <iframe>s as we override that for you.

Example

Wrap any embed like an <iframe> in a parent element with .embed-responsive and an aspect ratio. The .embed-responsive-item isn’t strictly required, but we encourage it.


                    <div class="embed-responsive embed-responsive-16by9">
                      <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
                    </div>
                    
Aspect ratios

Aspect ratios can be customized with modifier classes.


                    <!-- 21:9 aspect ratio -->
                    <div class="embed-responsive embed-responsive-21by9">
                      <iframe class="embed-responsive-item" src="..."></iframe>
                    </div>
                    
                    <!-- 16:9 aspect ratio -->
                    <div class="embed-responsive embed-responsive-16by9">
                      <iframe class="embed-responsive-item" src="..."></iframe>
                    </div>
                    
                    <!-- 4:3 aspect ratio -->
                    <div class="embed-responsive embed-responsive-4by3">
                      <iframe class="embed-responsive-item" src="..."></iframe>
                    </div>
                    
                    <!-- 1:1 aspect ratio -->
                    <div class="embed-responsive embed-responsive-1by1">
                      <iframe class="embed-responsive-item" src="..."></iframe>
                    </div>
                    

Flex

Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.

Enable flex behaviors

Apply display utilities to create a flexbox container and transform direct children elements into flex items. Flex containers and items are able to be modified further with additional flex properties.

I'm a flexbox container!

                    <div class="d-flex p-2">I'm a flexbox container!</div>
                    
I'm an inline flexbox container!

                    <div class="d-inline-flex p-2">I'm an inline flexbox container!</div>
                    

Responsive variations also exist for .d-flex and .d-inline-flex.

  • .d-flex
  • .d-inline-flex
  • .d-sm-flex
  • .d-sm-inline-flex
  • .d-md-flex
  • .d-md-inline-flex
  • .d-lg-flex
  • .d-lg-inline-flex
  • .d-xl-flex
  • .d-xl-inline-flex
Direction

Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is row. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts).

Use .flex-row to set a horizontal direction (the browser default), or .flex-row-reverse to start the horizontal direction from the opposite side.

Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3

                    <div class="d-flex flex-row">
                      <div class="p-2">Flex item 1</div>
                      <div class="p-2">Flex item 2</div>
                      <div class="p-2">Flex item 3</div>
                    </div>
                    <div class="d-flex flex-row-reverse">
                      <div class="p-2">Flex item 1</div>
                      <div class="p-2">Flex item 2</div>
                      <div class="p-2">Flex item 3</div>
                    </div>
                    

Use .flex-column to set a vertical direction, or .flex-column-reverse to start the vertical direction from the opposite side.

Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3

                    <div class="d-flex flex-column">
                      <div class="p-2">Flex item 1</div>
                      <div class="p-2">Flex item 2</div>
                      <div class="p-2">Flex item 3</div>
                    </div>
                    <div class="d-flex flex-column-reverse">
                      <div class="p-2">Flex item 1</div>
                      <div class="p-2">Flex item 2</div>
                      <div class="p-2">Flex item 3</div>
                    </div>
                    

Responsive variations also exist for flex-direction.

  • .flex-row
  • .flex-row-reverse
  • .flex-column
  • .flex-column-reverse
  • .flex-sm-row
  • .flex-sm-row-reverse
  • .flex-sm-column
  • .flex-sm-column-reverse
  • .flex-md-row
  • .flex-md-row-reverse
  • .flex-md-column
  • .flex-md-column-reverse
  • .flex-lg-row
  • .flex-lg-row-reverse
  • .flex-lg-column
  • .flex-lg-column-reverse
  • .flex-xl-row
  • .flex-xl-row-reverse
  • .flex-xl-column
  • .flex-xl-column-reverse
Justify content

Use justify-content utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column). Choose from start (browser default), end, center, between, or around.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex justify-content-start">...</div>
                    <div class="d-flex justify-content-end">...</div>
                    <div class="d-flex justify-content-center">...</div>
                    <div class="d-flex justify-content-between">...</div>
                    <div class="d-flex justify-content-around">...</div>
                    

Responsive variations also exist for justify-content.

  • .justify-content-start
  • .justify-content-end
  • .justify-content-center
  • .justify-content-between
  • .justify-content-around
  • .justify-content-sm-start
  • .justify-content-sm-end
  • .justify-content-sm-center
  • .justify-content-sm-between
  • .justify-content-sm-around
  • .justify-content-md-start
  • .justify-content-md-end
  • .justify-content-md-center
  • .justify-content-md-between
  • .justify-content-md-around
  • .justify-content-lg-start
  • .justify-content-lg-end
  • .justify-content-lg-center
  • .justify-content-lg-between
  • .justify-content-lg-around
  • .justify-content-xl-start
  • .justify-content-xl-end
  • .justify-content-xl-center
  • .justify-content-xl-between
  • .justify-content-xl-around
Align items

Use align-items utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from start, end, center, baseline, or stretch (browser default).

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-items-start">...</div>
                    <div class="d-flex align-items-end">...</div>
                    <div class="d-flex align-items-center">...</div>
                    <div class="d-flex align-items-baseline">...</div>
                    <div class="d-flex align-items-stretch">...</div>
                    

Responsive variations also exist for align-items.

  • .align-items-start
  • .align-items-end
  • .align-items-center
  • .align-items-baseline
  • .align-items-stretch
  • .align-items-sm-start
  • .align-items-sm-end
  • .align-items-sm-center
  • .align-items-sm-baseline
  • .align-items-sm-stretch
  • .align-items-md-start
  • .align-items-md-end
  • .align-items-md-center
  • .align-items-md-baseline
  • .align-items-md-stretch
  • .align-items-lg-start
  • .align-items-lg-end
  • .align-items-lg-center
  • .align-items-lg-baseline
  • .align-items-lg-stretch
  • .align-items-xl-start
  • .align-items-xl-end
  • .align-items-xl-center
  • .align-items-xl-baseline
  • .align-items-xl-stretch
Align self

Use align-self utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from the same options as align-items: start, end, center, baseline, or stretch (browser default).

Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item

                    <div class="align-self-start">Aligned flex item</div>
                    <div class="align-self-end">Aligned flex item</div>
                    <div class="align-self-center">Aligned flex item</div>
                    <div class="align-self-baseline">Aligned flex item</div>
                    <div class="align-self-stretch">Aligned flex item</div>
                    

Responsive variations also exist for align-self.

  • .align-self-start
  • .align-self-end
  • .align-self-center
  • .align-self-baseline
  • .align-self-stretch
  • .align-self-sm-start
  • .align-self-sm-end
  • .align-self-sm-center
  • .align-self-sm-baseline
  • .align-self-sm-stretch
  • .align-self-md-start
  • .align-self-md-end
  • .align-self-md-center
  • .align-self-md-baseline
  • .align-self-md-stretch
  • .align-self-lg-start
  • .align-self-lg-end
  • .align-self-lg-center
  • .align-self-lg-baseline
  • .align-self-lg-stretch
  • .align-self-xl-start
  • .align-self-xl-end
  • .align-self-xl-center
  • .align-self-xl-baseline
  • .align-self-xl-stretch
Auto margins

Flexbox can do some pretty awesome things when you mix flex alignments with auto margins. Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the right (.mr-auto), and pushing two items to the left (.ml-auto).

Unfortunately, IE10 and IE11 do not properly support auto margins on flex items whose parent has a non-default justify-content value. See this StackOverflow answer for more details.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex">
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                    </div>
                    
                    <div class="d-flex">
                      <div class="mr-auto p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                    </div>
                    
                    <div class="d-flex">
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                      <div class="ml-auto p-2">Flex item</div>
                    </div>
                    
With align-items

Vertically move one flex item to the top or bottom of a container by mixing align-items, flex-direction: column, and margin-top: auto or margin-bottom: auto.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-items-start flex-column" style="height: 200px;">
                      <div class="mb-auto p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                    </div>
                    
                    <div class="d-flex align-items-end flex-column" style="height: 200px;">
                      <div class="p-2">Flex item</div>
                      <div class="p-2">Flex item</div>
                      <div class="mt-auto p-2">Flex item</div>
                    </div>
                    
Wrap

Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with .flex-nowrap, wrapping with .flex-wrap, or reverse wrapping with .flex-wrap-reverse.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex flex-nowrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex flex-wrap-reverse">
                      ...
                    </div>
                    

Responsive variations also exist for flex-wrap.

  • .flex-nowrap
  • .flex-wrap
  • .flex-wrap-reverse
  • .flex-sm-nowrap
  • .flex-sm-wrap
  • .flex-sm-wrap-reverse
  • .flex-md-nowrap
  • .flex-md-wrap
  • .flex-md-wrap-reverse
  • .flex-lg-nowrap
  • .flex-lg-wrap
  • .flex-lg-wrap-reverse
  • .flex-xl-nowrap
  • .flex-xl-wrap
  • .flex-xl-wrap-reverse
Order

Change the visual order of specific flex items with a handful of order utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order. As order takes any integer value (e.g., 5), add custom CSS for any additional values needed.

First flex item
Second flex item
Third flex item

                    <div class="d-flex flex-nowrap">
                      <div class="order-3 p-2">First flex item</div>
                      <div class="order-2 p-2">Second flex item</div>
                      <div class="order-1 p-2">Third flex item</div>
                    </div>
                    

Responsive variations also exist for order.

  • .order-1
  • .order-2
  • .order-3
  • .order-4
  • .order-5
  • .order-6
  • .order-7
  • .order-8
  • .order-9
  • .order-10
  • .order-11
  • .order-12
  • .order-sm-1
  • .order-sm-2
  • .order-sm-3
  • .order-sm-4
  • .order-sm-5
  • .order-sm-6
  • .order-sm-7
  • .order-sm-8
  • .order-sm-9
  • .order-sm-10
  • .order-sm-11
  • .order-sm-12
  • .order-md-1
  • .order-md-2
  • .order-md-3
  • .order-md-4
  • .order-md-5
  • .order-md-6
  • .order-md-7
  • .order-md-8
  • .order-md-9
  • .order-md-10
  • .order-md-11
  • .order-md-12
  • .order-lg-1
  • .order-lg-2
  • .order-lg-3
  • .order-lg-4
  • .order-lg-5
  • .order-lg-6
  • .order-lg-7
  • .order-lg-8
  • .order-lg-9
  • .order-lg-10
  • .order-lg-11
  • .order-lg-12
  • .order-xl-1
  • .order-xl-2
  • .order-xl-3
  • .order-xl-4
  • .order-xl-5
  • .order-xl-6
  • .order-xl-7
  • .order-xl-8
  • .order-xl-9
  • .order-xl-10
  • .order-xl-11
  • .order-xl-12
Align content

Use align-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), end, center, between, around, or stretch. To demonstrate these utilities, we’ve enforced flex-wrap: wrap and increased the number of flex items.

Heads up! This property has no effect on single rows of flex items.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-start flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-end flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-center flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-between flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-around flex-wrap">
                      ...
                    </div>
                    
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

                    <div class="d-flex align-content-stretch flex-wrap">
                      ...
                    </div>
                    

Responsive variations also exist for align-content.

  • .align-content-start
  • .align-content-end
  • .align-content-center
  • .align-content-around
  • .align-content-stretch
  • .align-content-sm-start
  • .align-content-sm-end
  • .align-content-sm-center
  • .align-content-sm-around
  • .align-content-sm-stretch
  • .align-content-md-start
  • .align-content-md-end
  • .align-content-md-center
  • .align-content-md-around
  • .align-content-md-stretch
  • .align-content-lg-start
  • .align-content-lg-end
  • .align-content-lg-center
  • .align-content-lg-around
  • .align-content-lg-stretch
  • .align-content-xl-start
  • .align-content-xl-end
  • .align-content-xl-center
  • .align-content-xl-around
  • .align-content-xl-stretch

Float

Toggle floats on any element, across any breakpoint, using our responsive float utilities.

These utility classes float an element to the left or right, or disable floating, based on the current viewport size using the CSS float property. !important is included to avoid specificity issues. These use the same viewport breakpoints as our grid system.

Toggle a float with a class:

Float left on all viewport sizes

Float right on all viewport sizes

Don't float on all viewport sizes

                    <div class="float-left">Float left on all viewport sizes</div><br>
                    <div class="float-right">Float right on all viewport sizes</div><br>
                    <div class="float-none">Don't float on all viewport sizes</div>
                    
Responsive

Responsive variations also exist for each float value.

Float left on viewports sized SM (small) or wider

Float left on viewports sized MD (medium) or wider

Float left on viewports sized LG (large) or wider

Float left on viewports sized XL (extra-large) or wider


                    <div class="float-sm-left">Float left on viewports sized SM (small) or wider</div><br>
                    <div class="float-md-left">Float left on viewports sized MD (medium) or wider</div><br>
                    <div class="float-lg-left">Float left on viewports sized LG (large) or wider</div><br>
                    <div class="float-xl-left">Float left on viewports sized XL (extra-large) or wider</div><br>
                    

Here are all the support classes;

  • .float-left
  • .float-right
  • .float-none
  • .float-sm-left
  • .float-sm-right
  • .float-sm-none
  • .float-md-left
  • .float-md-right
  • .float-md-none
  • .float-lg-left
  • .float-lg-right
  • .float-lg-none
  • .float-xl-left
  • .float-xl-right
  • .float-xl-none

Image replacement

Swap text for background images with the image replacement class.

Utilize the .text-hide class or mixin to help replace an element’s text content with a background image.


                    <h1 class="text-hide">Custom heading</h1>
                    

Use the .text-hide class to maintain the accessibility and SEO benefits of heading tags, but want to utilize a background-image instead of text.

Bootstrap


                    <h1 class="text-hide my-2" style="background-image: url('../../../app-assets/images/logo/logo.png'); width: 30px; height: 26px;">Bootstrap</h1>
                    

Position

Use these shorthand utilities for quickly configuring the position of an element.

Classes Description
.position-fixed Changes element's position to fixed.
.position-relative Changes element's position to relative.
.position-absolute Changes element's position to absolute.
.position-static Changes element's position to static.
.position-sticky Changes element's position to static.
Fixed top

Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add aditional CSS.


                    <div class="fixed-top">...</div>
                    
Fixed bottom

Position an element at the bottom of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add aditional CSS.


                    <div class="fixed-bottom">...</div>
                    
Sticky top

Position an element at the top of the viewport, from edge to edge, but only after you scroll past it. The .sticky-top utility uses CSS’s position: sticky, which isn’t fully supported in all browsers.

Microsoft Edge and IE11 will render position: sticky as position: relative. As such, we wrap the styles in a @supports query, limiting the stickiness to only browsers that properly can render it.


                    <div class="sticky-top">...</div>
                    

Screenreaders

Use screenreader utilities to hide elements on all devices except screen readers.

Hide an element to all devices except screen readers with .sr-only. Combine .sr-only with .sr-only-focusable to show the element again when it’s focused (e.g. by a keyboard-only user). Can also be used as mixins.


                    <a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>
                    

Sizing

Easily make an element as wide or as tall (relative to its parent) with our width and height utilities.

Width and height utilities are generated from the $sizes Sass map in _variables.scss. Includes support for 25%, 50%, 75%, and 100% by default. Modify those values as you need to generate different utilities here.

Width 25%
Width 50%
Width 75%
Width 100%

                    <div class="w-25 p-3" style="background-color: #eee;">Width 25%</div>
                    <div class="w-50 p-3" style="background-color: #eee;">Width 50%</div>
                    <div class="w-75 p-3" style="background-color: #eee;">Width 75%</div>
                    <div class="w-100 p-3" style="background-color: #eee;">Width 100%</div>
                    
Height 25%
Height 50%
Height 75%
Height 100%

                    <div style="height: 100px; background-color: rgba(255,0,0,0.1);">
                      <div class="h-25 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 25%</div>
                      <div class="h-50 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 50%</div>
                      <div class="h-75 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 75%</div>
                      <div class="h-100 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 100%</div>
                    </div>
                    

You can also use max-width: 100%; and max-height: 100%; utilities as needed.

Max-width = 100% [1000%x100]

                        <img class="mw-100" src="..." alt="Max-width 100%">
                    
Max-height 100%

                    <div style="height: 100px; background-color: rgba(255,0,0,0.1);">
                      <div class="mh-100" style="width: 100px; height: 200px; background-color: rgba(0,0,255,0.1);">Max-height 100%</div>
                    </div>
                    
Width && Height

Add one of these to class to set width of the content.

Classes Description
.fit Set content maximum width 100%.
.half-width Set content width 50%.
.full-width Set content width 100%.
.full-height Set content height 100%.
Fixed Width

Add one of these to class to set fixed width of the content.

Classes Description
.width-{size} Set content fixed width in pixel of selected size where size can be 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750 and 800. i.e .width-50
.width-{size}-per Set content fixed width in percentage of selected size where size can be 5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75% and 80%. i.e .width-5-per
Fixed Height

Add one of these to class to set fixed height of the content.

Classes Description
.height-{size} Set content fixed height in pixel of selected size where size can be 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750 and 800. i.e .height-50
.height-{size}-per Set content fixed height in percentage of selected size where size can be 5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75% and 80%. i.e .height-5-per

Spacing

Bootstrap includes a wide range of shorthand responsive margin and padding utility classes to modify an element's appearance.

How it works

Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. Classes are built from a default Sass map ranging from .25rem to 3rem.

Notation

Spacing utilities that apply to all breakpoints, from xs to xl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0 and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, and xl.

Where property is one of:

  • m - for classes that set margin
  • p - for classes that set padding

Where sides is one of:

  • t - for classes that set margin-top or padding-top
  • b - for classes that set margin-bottom or padding-bottom
  • l - for classes that set margin-left or padding-left
  • r - for classes that set margin-right or padding-right
  • x - for classes that set both *-left and *-right
  • y - for classes that set both *-top and *-bottom
  • blank - for classes that set a margin or padding on all 4 sides of the element

Where size is one of:

  • 0 - for classes that eliminate the margin or padding by setting it to 0
  • 1 - (by default) for classes that set the margin or padding to $spacer * .25
  • 2 - (by default) for classes that set the margin or padding to $spacer * .5
  • 3 - (by default) for classes that set the margin or padding to $spacer
  • 4 - (by default) for classes that set the margin or padding to $spacer * 1.5
  • 5 - (by default) for classes that set the margin or padding to $spacer * 3
  • auto - for classes that set the margin to auto

(You can add more sizes by adding entries to the $spacers Sass map variable.)

Horizontal centering

Additionally, Bootstrap also includes an .mx-auto class for horizontally centering fixed-width block level content—that is, content that has display: block and a width set—by setting the horizontal margins to auto.

Centered element

                    <div class="mx-auto" style="width: 200px;">
                      Centered element
                    </div>
                    

Vertical alignment

Easily change the vertical alignment of inline, inline-block, inline-table, and table cell elements.

Change the alignment of elements with the vertical-alignment utilities. Please note that vertical-align only affects inline, inline-block, inline-table, and table cell elements.

Choose from .align-baseline, .align-top, .align-middle, .align-bottom, .align-text-bottom, and .align-text-top as needed.

baseline top middle bottom text-top text-bottom
Classes Description
.align-top Changes element's vertical alignment to top.
.align-middle Changes element's vertical alignment to middle.
.align-bottom Changes element's vertical alignment to bottom.
.align-baseline Changes element's vertical alignment to baseline.
.align-text-top Top of the element is aligned with the top of the parent element's font.
.align-text-bottom The bottom of the element is aligned with the bottom of the parent element's font.

With table cells:

baseline top middle bottom text-top text-bottom

                    <table style="height: 100px;">
                      <tbody>
                        <tr>
                          <td class="align-baseline">baseline</td>
                          <td class="align-top">top</td>
                          <td class="align-middle">middle</td>
                          <td class="align-bottom">bottom</td>
                          <td class="align-text-top">text-top</td>
                          <td class="align-text-bottom">text-bottom</td>
                        </tr>
                      </tbody>
                    </table>
                    

Transformations

Add one of these to class to change transformations of the element.

Classes Description
.icon-rotate-right-45 icon-rotate-rights element 45 degreees clockwise.
.icon-rotate-right-45-inverse icon-rotate-rights element 45 degreees anti-clockwise.
.icon-rotate-right-90 icon-rotate-rights element 90 degreees clockwise.
.icon-rotate-right-90-inverse icon-rotate-rights element 90 degreees anti-clockwise.
.icon-rotate-right-180 icon-rotate-rights element 180 degreees clockwise.
.icon-rotate-right-180-inverse icon-rotate-rights element 180 degreees anti-clockwise.
.spinner Set element infinite clockwise rotation.
.spinner-reverse Set element infinite anti-clockwise rotation.

Image

Add one of these to class to change image size and other property.

Classes Description
.bg-cover Scale the background image to be as large as possible so that the background area is completely covered by the background image.
.bg-repeat Do not repeat the background image.
.bg-no-repeat Repeat the background image.

Content helpers

z-index

Add one of these classes to change the elemets' z-index properties.

Classes Description
.zindex-minus-1 Set element's z-index value minus 1.
.zindex-minus-2 Set element's z-index value minus 2.
.zindex-minus-3 Set element's z-index value minus 3.
.zindex-minus-4 Set element's z-index value minus 4.
.zindex-0 Set element's z-index value 0.
.zindex-1 Set element's z-index value 1.
.zindex-2 Set element's z-index value 2.
.zindex-3 Set element's z-index value 3.
.zindex-4 Set element's z-index value 4.
Edges

Add one of these to removes the slected edge of the elements, works with absolute, fixed and relative positioned elements.

Classes Description
.no-edge-top Removes the top edge of the element.
.no-edge-bottom Removes the bottom edge of the element.
.no-edge-left Removes the left edge of the element.
.no-edge-right Removes the right edge of the element.
Cursors

Add one of these to class to change cursor style.

Classes Description
.cursor-pointer The cursor is a pointer and indicates a link. Useful for user interaction feedback.
.cursor-move The cursor indicates something is to be moved. Used in shortable components
.cursor-default Set cursor to browser default style.
.cursor-progress The cursor indicates that the program is busy (in progress).
.cursor-not-allowed The cursor indicates that the requested action will not be executed.
Overflow

Add one of these to class to change overflow of element.

Classes Description
.overflow-visible Default. The overflow is not clipped. It renders outside the element's box.
.overflow-hidden The overflow is clipped, and the rest of the content will be invisible.
.overflow-auto If overflow is clipped, a scrollbar should be added to see the rest of the content.
.overflow-scroll The overflow is clipped, but a scrollbar is added to see the rest of the content.
List

Add one of these to class to change list style.

Classes Description
.no-bullets No marker is shown in the list item.
.bullets-inside Indents the marker and the text. The bullets appear inside the content flow
.list-style-circle Set the list item marker to circle.
.list-style-square Set the list item marker to square.

Visibility

Control the visibility, without modifying the display, of elements with visibility utilities.

Set the visibility of elements with our visibility utilities. These do not modify the display value at all and are helpful for hiding content from most users, but still keeping them for screen readers.

Apply .visible or .invisible as needed.


                    <div class="visible">...</div>
                    <div class="invisible">...</div>