Columns

Vue Bootstrap 5 Columns

Learn how to modify columns with a handful of options for alignment, ordering, and offsetting thanks to our flexbox grid system. Plus, see how to use column classes to manage widths of non-grid elements.

Note: Be sure to read the Grid page first before diving into how to modify and customize your grid columns.


How it works

  • Columns build on the grid’s flexbox architecture. Flexbox means we have options for changing individual columns and modifying groups of columns at the row level. You choose how columns grow, shrink, or otherwise change.

  • When building grid layouts, all content goes in columns. The hierarchy of Bootstrap’s grid goes from container to row to column to your content. On rare occasions, you may combine content and column, but be aware there can be unintended consequences.

  • Bootstrap includes predefined classes for creating fast, responsive layouts. With six breakpoints and a dozen columns at each grid tier, we have dozens of classes already built for you to create your desired layouts. This can be disabled via Sass if you wish.


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
        
            
              <template>
                <MDBContainer>
                  <MDBRow class="align-items-start bg-body-tertiary mb-3" style="height: 100px">
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                  </MDBRow>
                  <MDBRow class="align-items-center bg-body-tertiary mb-3" style="height: 100px">
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                  </MDBRow>
                  <MDBRow class="align-items-end bg-body-tertiary mb-3" style="height: 100px">
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                    <MDBCol class="col-example">One of three columns</MDBCol>
                  </MDBRow>
                </MDBContainer>
              </template>
            
        
    
        
            
              <script>
                import { MDBCol, MDBRow, MDBContainer } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow,
                    MDBContainer
                  },
                };
              </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow, MDBContainer } from 'mdb-vue-ui-kit';
              </script>
            
        
    
One of three columns
One of three columns
One of three columns
        
            
              <template>
                <MDBContainer>
                  <MDBRow>
                    <MDBCol class="align-self-start">
                      One of three columns
                    </MDBCol>
                    <MDBCol class="align-self-center">
                      One of three columns
                    </MDBCol>
                    <MDBCol class="align-self-end">
                      One of three columns
                    </MDBCol>
                  </MDBRow>
                </MDBContainer>
              </template>
            
        
    
        
            
              <script>
                import { MDBCol, MDBRow, MDBContainer } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow,
                    MDBContainer
                  },
                };
              </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow, MDBContainer } from 'mdb-vue-ui-kit';
              </script>
            
        
    

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
        
            
            <template>
              <MDBRow start>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
              <MDBRow class="justify-content-center">
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
              <MDBRow class="justify-content-end">
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
              <MDBRow class="justify-content-around">
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
              <MDBRow class="justify-content-between">
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
              <MDBRow class="justify-content-evenly">
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
                <MDBCol col="4">
                  One of two columns
                </MDBCol>
              </MDBRow>
            </template>
            
        
    
        
            
              <script>
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow
                  },
                };
              </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

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.
        
            
            <template>
              <MDBRow>
                <MDBCol col="9">col="9"</MDBCol>
                <MDBCol col="4">
                  col="4"<br />Since 9 + 4 = 13 &gt; 12, this 4-column-wide div
                  gets wrapped onto a new line as one contiguous unit.
                </MDBCol>
                <MDBCol col="6">
                  col="6"<br />Subsequent columns continue along the new line.
                </MDBCol>
              </MDBRow>
            </template>
            
        
    
        
            
            <script>
              import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol,
                  MDBRow
                },
              };
            </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

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 MDBRows, but not every implementation method can account for this.

col="6" sm="3"
col="6" sm="3"
col="6" sm="3"
col="6" sm="3"
        
            
            <template>
              <MDBRow>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>

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

                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
              </MDBRow>
            </template>
          
        
    
        
            
            <script>
              import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol,
                  MDBRow
                },
              };
            </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

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

col="6" sm="3"
col="6" sm="3"
col="6" sm="3"
col="6" sm="3"
        
            
            <template>
              <MDBRow>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>

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

                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
                <MDBCol col="6" sm="3">col="6" sm="3"</MDBCol>
              </MDBRow>
            </template>
            
        
    
        
            
            <script>
              import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol,
                  MDBRow
                },
              };
            </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

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 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
        
            
            <template>
              <MDBRow>
                <MDBCol>
                  First in DOM, no order applied
                </MDBCol>
                <MDBCol class="order-5">
                  Second in DOM, with a larger order
                </MDBCol>
                <MDBCol class="order-1">
                  Third in DOM, with an order of 1
                </MDBCol>
              </MDBRow>
            </template>
            
        
    
        
            
            <script>
              import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol,
                  MDBRow
                },
              };
            </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

There are also responsive .order-first and .order-last classes that change the order of an element by applying order: -1 and order: 6, respectively. These classes can also be intermixed with the numbered .order-* classes as needed.

First in DOM, ordered last
Second in DOM, unordered
Third in DOM, ordered first
        
            
            <template>
              <MDBRow>
                <MDBCol class="order-last">
                  First in DOM, ordered last
                </MDBCol>
                <MDBCol>
                  Second in DOM, unordered
                </MDBCol>
                <MDBCol class="order-first">
                  Third in DOM, ordered first
                </MDBCol>
              </MDBRow>
            </template>
            
        
    
        
            
            <script>
              import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol,
                  MDBRow
                },
              };
            </script>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
              </script>
            
        
    

Offsetting columns

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

Offset properties

Move columns to the right using offsetMd="*" property. These classes increase the left margin of a column by * columns. For example, offsetMd="4" moves md="4" over four columns.

md="4"
md="4" offsetMd="4"
md="3" offsetMd="3"
md="3" offsetMd="3"
md="6" offsetMd="3"
        
            
              <template>
                <MDBRow>
                  <MDBCol md="4" >md="4"</MDBCol>
                  <MDBCol md="4" class="offset-md-4">
                    md="4" offsetMd="4"
                  </MDBCol>
                </MDBRow>
                <MDBRow>
                  <MDBCol md="3" class="offset-md-3">
                    md="3" offsetMd="3"
                  </MDBCol>
                  <MDBCol md="3" class="offset-md-3">
                    md="3" offsetMd="3"
                  </MDBCol>
                </MDBRow>
                <MDBRow>
                  <MDBCol md="6" class="offset-md-3">
                    md="6" offsetMd="3"
                  </MDBCol>
                </MDBRow>
              </template>
              
        
    
        
            
              <script>
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow
                  },
                };
              </script>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
                </script>
              
        
    

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

sm="5" md="6"
sm="5" offsetSm="2" md="6" offsetMd="0"
sm="6" md="5" lg="6"
sm="6" md="5" offsetMd="2" lg="6" offsetLg="0"
        
            
              <template>
                <MDBRow>
                  <MDBCol sm="5" md="6">sm="5" md="6"</MDBCol>
                  <MDBCol sm="5" md="6" class="offset-sm-2 offset-md-0">sm="5" offsetSm="2" md="6" offsetMd="0"</MDBCol>
                </MDBRow>
                <MDBRow>
                  <MDBCol sm="6" md="5" lg="6">sm="6" md="5" lg="6"</MDBCol>
                  <MDBCol sm="6" md="5" lg="6" class="offset-md-2 offset-lg-0">sm="6" md="5" offsetMd="2" lg="6" offsetLg="0"</MDBCol>
                </MDBRow>
              </template>
              
        
    
        
            
              <script>
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow
                  },
                };
              </script>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
                </script>
              
        
    

Margin utilities

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

md="4"
md="4" class="ms-auto"
md="3" class="ms-md-auto"
md="3" class="ms-md-auto"
col="auto" class="me-auto"
col="auto"
        
            
              <template>
                <MDBRow>
                  <MDBCol md="4">md="4"</MDBCol>
                  <MDBCol md="4" class="ms-auto">md="4" class="ms-auto"</MDBCol>
                </MDBRow>
                <MDBRow>
                  <MDBCol md="3" class="ms-md-auto">md="3" class="ms-md-auto"</MDBCol>
                  <MDBCol md="3" class="ms-md-auto">md="3" class="ms-md-auto"</MDBCol>
                </MDBRow>
                <MDBRow>
                  <MDBCol col="auto" class="me-auto">col="auto" class="me-auto"</MDBCol>
                  <MDBCol col="auto">col="auto"</MDBCol>
                </MDBRow>
              </template>
              
        
    
        
            
              <script>
                import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';

                export default {
                  components: {
                    MDBCol,
                    MDBRow
                  },
                };
              </script>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBCol, MDBRow } from 'mdb-vue-ui-kit';
                </script>
              
        
    

Standalone column classes

The col="*" properties can also be used outside a MDBCol 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%
sm="9": width of 75% above sm breakpoint
        
            
          <template>
            <MDBCol col="3" class="p-3 border">
              col="3": width of 25%
            </MDBCol>
            <MDBCol sm="9" class="p-3 border">
              sm="9": width of 75% above sm breakpoint
            </MDBCol>
          </template>
          
        
    
        
            
          <script>
            import { MDBCol } from 'mdb-vue-ui-kit';

            export default {
              components: {
                MDBCol
              },
            };
          </script>
          
        
    
        
            
            <script setup lang="ts">
              import { MDBCol } from 'mdb-vue-ui-kit';
            </script>
          
        
    

The classes can be used together with utilities to create responsive floated images. Make sure to wrap the content in a .clearfix wrapper to clear the float if the text is shorter.

Placeholder Responsive floated image

Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris paddenstoel nibh, ut fermentum massa justo sit amet risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Sed posuere consectetur est at lobortis. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Id nullam tellus relem amet commodo telemque olemit. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras justo odio, dapibus ac facilisis in, egestas eget quam.

Donec id elit non mi porta gravida at eget metus. Aenean eu leo quam. Pellentesque ornare sem lantaarnpaal quam venenatis vestibulum. Donec sed odio dui. Maecenas faucibus mollis interdum. Nullam quis risus eget urna salsa tequila vel eu leo. Donec id elit non mi porta gravida at eget metus.

        
            
          <template>
            <div class="clearfix">
              <MDBCol md="6" tag="img" src="..." class="float-md-end mb-3 ms-md-3" alt="..."></MDBCol>
              <p>
                Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris paddenstoel nibh, ut fermentum massa justo sit amet risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
              </p>
              <p>
                Sed posuere consectetur est at lobortis. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Id nullam tellus relem amet commodo telemque olemit. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
              </p>
              <p>
                Donec id elit non mi porta gravida at eget metus. Aenean eu leo quam. Pellentesque ornare sem lantaarnpaal quam venenatis vestibulum. Donec sed odio dui. Maecenas faucibus mollis interdum. Nullam quis risus eget urna salsa tequila vel eu leo. Donec id elit non mi porta gravida at eget metus.
              </p>
            </div>
          </template>
          
        
    
        
            
            <script>
              import { MDBCol } from 'mdb-vue-ui-kit';

              export default {
                components: {
                  MDBCol
                },
              };
            </script>
          
        
    
        
            
            <script setup lang="ts">
              import { MDBCol } from 'mdb-vue-ui-kit';
            </script>