Table responsive

Bootstrap table responsive

Note: We are transitioning MDB4 to a legacy version and focusing on developing MDB5. While we'll continue to support for the transition period, we encourage you to migrate to MDB5. We're offering a huge discount on MDB5 PRO to help with your transition, enabling you to leverage the full potential of the latest version. You can find more information here.
upgrade with discount

Responsive tables allow tables to be scrolled horizontally with ease. Make any table responsive across all viewports by wrapping a .table with .table-responsive. Or, pick a maximum breakpoint with which to have a responsive table up to by using one of .table-responsive{-sm|-md|-lg|-xl}.

Vertical clipping/truncation

Responsive tables make use of overflow-y: hidden, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.


Always responsive

Across every breakpoint, you can use .table-responsive for horizontally scrolling tables.

# Heading Heading Heading Heading Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell Cell Cell Cell Cell
        
            

        <div class="table-responsive">
          <table class="table">
            <thead>
              <tr>
                <th scope="col">#</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
                <th scope="col">Heading</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <th scope="row">1</th>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
                <td>Cell</td>
              </tr>
            </tbody>
          </table>
        </div>

      
        
    

Breakpoint specific

Use .table-responsive{-sm|-md|-lg|-xl} classes as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.

# Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell

# Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell

# Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell

# Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell
        
            

        <div class="table-responsive-sm">
          <table class="table">
            ...
          </table>
        </div>

        <div class="table-responsive-md">
          <table class="table">
            ...
          </table>
        </div>

        <div class="table-responsive-lg">
          <table class="table">
            ...
          </table>
        </div>

        <div class="table-responsive-xl">
          <table class="table">
            ...
          </table>
        </div>

      
        
    

Bootstrap table column width

You can use one of the following classes to manipulate the width of the columns.

Table columns with auto width

Just add the .w-auto class to the table element to set an auto width to the table column.

The width of the columns will automatically adjust to the content of the column. This means that it will always take up the minimum width required to present its content.

# Name Surname Country City Position Age
1 Kate Moss USA New York City Web Designer 23
2 Anna Wintour United Kingdom London Frontend Developer 36
3 Tom Bond Spain Madrid Photographer 25
4 Jerry Horwitz Italy Bari Editor-in-chief 41
5 Janis Joplin Poland Warsaw Video Maker 39
6 Gary Winogrand Germany Berlin Photographer 37
7 Angie Smith USA San Francisco Teacher 52
8 John Mattis France Paris Actor 28
9 Otto Morris Germany Munich Singer 35
        
            

        <!--Table-->
        <table class="table table-striped w-auto">

          <!--Table head-->
          <thead>
            <tr>
              <th>#</th>
              <th>Name</th>
              <th>Surname</th>
              <th>Country</th>
              <th>City</th>
              <th>Position</th>
              <th>Age</th>
            </tr>
          </thead>
          <!--Table head-->

          <!--Table body-->
          <tbody>
            <tr class="table-info">
              <th scope="row">1</th>
              <td>Kate</td>
              <td>Moss</td>
              <td>USA</td>
              <td>New York City</td>
              <td>Web Designer</td>
              <td>23</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td>Anna</td>
              <td>Wintour</td>
              <td>United Kingdom</td>
              <td>London</td>
              <td>Frontend Developer</td>
              <td>36</td>
            </tr>
            <tr class="table-info">
              <th scope="row">3</th>
              <td>Tom</td>
              <td>Bond</td>
              <td>Spain</td>
              <td>Madrid</td>
              <td>Photographer</td>
              <td>25</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td>Jerry</td>
              <td>Horwitz</td>
              <td>Italy</td>
              <td>Bari</td>
              <td>Editor-in-chief</td>
              <td>41</td>
            </tr>
            <tr class="table-info">
              <th scope="row">5</th>
              <td>Janis</td>
              <td>Joplin</td>
              <td>Poland</td>
              <td>Warsaw</td>
              <td>Video Maker</td>
              <td>39</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td>Gary</td>
              <td>Winogrand</td>
              <td>Germany</td>
              <td>Berlin</td>
              <td>Photographer</td>
              <td>37</td>
            </tr>
            <tr class="table-info">
              <th scope="row">7</th>
              <td>Angie</td>
              <td>Smith</td>
              <td>USA</td>
              <td>San Francisco</td>
              <td>Teacher</td>
              <td>52</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td>John</td>
              <td>Mattis</td>
              <td>France</td>
              <td>Paris</td>
              <td>Actor</td>
              <td>28</td>
            </tr>
            <tr class="table-info">
              <th scope="row">9</th>
              <td>Otto</td>
              <td>Morris</td>
              <td>Germany</td>
              <td>Munich</td>
              <td>Singer</td>
              <td>35</td>
            </tr>
          </tbody>
          <!--Table body-->


        </table>
        <!--Table-->

      
        
    

Table columns with minimal width

You can use the .th-lg or .th-sm class to set a minimum width of a table column. The .th-lg class gives 9 rem of the minimum width of the column and .th-sm class gives 6 rem.

You have to add the .th-lg or th.sm class to the <th> element within the <thead>.

You will need to resize the browser window to see the effect.

.th-lg - 9 rem minimal width of all of the columns

# Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
1 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
2 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
3 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
        
            

        <div class="table-responsive">

          <!--Table-->
          <table class="table">

            <!--Table head-->
            <thead>
              <tr>
                <th>#</th>
                <th class="th-lg">Lorem ipsum dolor</th>
                <th class="th-lg">Lorem ipsum dolor</th>
                <th class="th-lg">Lorem ipsum dolor</th>
              </tr>
            </thead>
            <!--Table head-->

            <!--Table body-->
            <tbody>
              <tr>
                <th scope="row">1</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
            </tbody>
            <!--Table body-->

          </table>
          <!--Table-->

        </div>

      
        
    

.th-sm - 6 rem minimal width of the column

# Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
1 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
2 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
3 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
        
            

        <div class="table-responsive">

          <!--Table-->
          <table class="table">

            <!--Table head-->
            <thead>
              <tr>
                <th>#</th>
                <th class="th-sm">Lorem ipsum dolor</th>
                <th class="th-sm">Lorem ipsum dolor</th>
                <th class="th-sm">Lorem ipsum dolor</th>
              </tr>
            </thead>
            <!--Table head-->

            <!--Table body-->
            <tbody>
              <tr>
                <th scope="row">1</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
            </tbody>
            <!--Table body-->

          </table>
          <!--Table-->

        </div>

      
        
    

Table columns with fixed width

Add .table-fixed class to the table element to set a fixed width to all of the columns of the table.

A .table-fixed class will produce a table that is lot sturdier and more predictable with property/value in place.

When you use the class .table-fixed, the layout of your table is based on the first row.

# Name Surname Country City Position Age
4 Jerry Horwitz Italy Bari Editor-in-chief 41
5 Janis Joplin Poland Warsaw Video Maker 39
6 Gary Winogrand Germany Berlin Photographer 37
7 Angie Smith USA San Francisco Teacher 52
8 John Mattis France Paris Actor 28
9 Otto Morris Germany Munich Singer 35
        
            

        <!--Table-->
        <table class="table table-hover table-fixed">

          <!--Table head-->
          <thead>
            <tr>
              <th>#</th>
              <th>Name</th>
              <th>Surname</th>
              <th>Country</th>
              <th>City</th>
              <th>Position</th>
              <th>Age</th>
            </tr>
          </thead>
          <!--Table head-->

          <!--Table body-->
          <tbody>
            <tr>
              <th scope="row">4</th>
              <td>Jerry</td>
              <td>Horwitz</td>
              <td>Italy</td>
              <td>Bari</td>
              <td>Editor-in-chief</td>
              <td>41</td>
            </tr>
            <tr>
              <th scope="row">5</th>
              <td>Janis</td>
              <td>Joplin</td>
              <td>Poland</td>
              <td>Warsaw</td>
              <td>Video Maker</td>
              <td>39</td>
            </tr>
            <tr>
              <th scope="row">6</th>
              <td>Gary</td>
              <td>Winogrand</td>
              <td>Germany</td>
              <td>Berlin</td>
              <td>Photographer</td>
              <td>37</td>
            </tr>
            <tr>
              <th scope="row">7</th>
              <td>Angie</td>
              <td>Smith</td>
              <td>USA</td>
              <td>San Francisco</td>
              <td>Teacher</td>
              <td>52</td>
            </tr>
            <tr>
              <th scope="row">8</th>
              <td>John</td>
              <td>Mattis</td>
              <td>France</td>
              <td>Paris</td>
              <td>Actor</td>
              <td>28</td>
            </tr>
            <tr>
              <th scope="row">9</th>
              <td>Otto</td>
              <td>Morris</td>
              <td>Germany</td>
              <td>Munich</td>
              <td>Singer</td>
              <td>35</td>
            </tr>
          </tbody>
          <!--Table body-->

        </table>
        <!--Table-->

      
        
    

Table columns with text-nowrap

With the class .text-nowrap you can specify how white-space inside a table is handled.

Sequences of white space are preserved. Lines are broken at newline characters, at br, and as necessary to fill line boxes.

If you want to use a .text-nowrap class you have to use div wrapper with the .table-responsive class because your table will be broken on small screens.

For example here is a table with the text-nowrap class:

# Name Surname Country City Position Age
1 Kate Moss USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 23
2 Anna Wintour USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 36
3 Tom Bond USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 25
4 Jerry Horwitz USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 41
5 Janis Joplin USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 39
6 Gary Winogrand USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 37
7 Angie Smith USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 52
8 John Mattis USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 28
9 Otto Morris USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 35
        
            

        <div class="table-responsive text-nowrap">
          <!--Table-->
          <table class="table table-striped">

            <!--Table head-->
            <thead>
              <tr>
                <th>#</th>
                <th>Name</th>
                <th>Surname</th>
                <th>Country</th>
                <th>City</th>
                <th>Position</th>
                <th>Age</th>
              </tr>
            </thead>
            <!--Table head-->

            <!--Table body-->
            <tbody>
              <tr>
                <th scope="row">1</th>
                <td>Kate</td>
                <td>Moss</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>23</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Anna</td>
                <td>Wintour</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>36</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Tom</td>
                <td>Bond</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>25</td>
              </tr>
              <tr>
                <th scope="row">4</th>
                <td>Jerry</td>
                <td>Horwitz</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>41</td>
              </tr>
              <tr>
                <th scope="row">5</th>
                <td>Janis</td>
                <td>Joplin</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>39</td>
              </tr>
              <tr>
                <th scope="row">6</th>
                <td>Gary</td>
                <td>Winogrand</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>37</td>
              </tr>
              <tr>
                <th scope="row">7</th>
                <td>Angie</td>
                <td>Smith</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>52</td>
              </tr>
              <tr>
                <th scope="row">8</th>
                <td>John</td>
                <td>Mattis</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>28</td>
              </tr>
              <tr>
                <th scope="row">9</th>
                <td>Otto</td>
                <td>Morris</td>
                <td>USA / The United Kingdom / China / Russia </td>
                <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
                <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
                <td>35</td>
              </tr>
            </tbody>
            <!--Table body-->


          </table>
          <!--Table-->
        </div>
  </section>

  
        
    

Here is an example how of the same table looks without the class .text-nowrap (only 4 first rows).

# Name Surname Country City Position Age
1 Kate Moss USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 23
2 Anna Wintour USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 36
4 Jerry Horwitz USA / The United Kingdom / China / Russia New York City / Warsaw / Lodz / Amsterdam / London / Chicago Web Designer /UX designer / Ul designer / JavaScript Developer 41
        
            

      <div class="table-responsive">
        <!--Table-->
        <table class="table table-striped">

          <!--Table head-->
          <thead>
            <tr>
              <th>#</th>
              <th>Name</th>
              <th>Surname</th>
              <th>Country</th>
              <th>City</th>
              <th>Position</th>
              <th>Age</th>
            </tr>
          </thead>
          <!--Table head-->

          <!--Table body-->
          <tbody>
            <tr>
              <th scope="row">1</th>
              <td>Kate</td>
              <td>Moss</td>
              <td>USA / The United Kingdom / China / Russia </td>
              <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
              <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
              <td>23</td>
            </tr>
            <tr>
              <th scope="row">2</th>
              <td>Anna</td>
              <td>Wintour</td>
              <td>USA / The United Kingdom / China / Russia </td>
              <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
              <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
              <td>36</td>
            </tr>
            <tr>
              <th scope="row">4</th>
              <td>Jerry</td>
              <td>Horwitz</td>
              <td>USA / The United Kingdom / China / Russia </td>
              <td>New York City / Warsaw / Lodz / Amsterdam / London / Chicago</td>
              <td>Web Designer /UX designer / Ul designer / JavaScript Developer</td>
              <td>41</td>
            </tr>
          </tbody>
          <!--Table body-->
        </table>
        <!--Table-->
      </div>