Open In App

Bootstrap 5 Columns Wrapping

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Columns are an integral part of the grid system. The columns are placed inside the row that is wrapped by a container. If more than 12 columns are placed within a single row, they will wrap to the next line automatically as one unit. 

Bootstrap 5 Columns wrapping Classes: There is no specific class to wrap up the 13th or more than the 12th column, it automatically does that, you better to have knowledge about Bootstrap 5 Grid System Row Columns.

Syntax:

<div class="container">
<div class="row">
<div class="col-*">
...
</div>
</div>
</div>

Example 1: In this example, we set and wrap the column when it exceeds more than the 12 using .col wrap classes.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">

    <link href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" 
          rel="stylesheet">
    <script src=
"https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js">
    </script>
    <script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">
    </script>
</head>

<body>
    <div class="container text-center">
        <h1 class="text-success">GeeksforGeeks</h1>
        <h5>Bootstrap5 Columns wrapping</h5>
    </div>
    <div class="container text-center">
        <div class="row border bg-light">
            <div class="col-7 text-bg-info p-3 mb-2">
                .col-7
            </div>
            <div class="col-5 text-bg-success p-3 mb-2">
                .col-5
            </div>
            <div class="col-4 text-bg-primary p-3 mb-2">
                .col-4
            </div>
            <div class="col-6 text-bg-secondary p-3 mb-2">
                .col-6
            </div>
            <div class="col-3 text-bg-warning p-3 mb-2">
                .col-3
            </div>
        </div>
    </div>
</body>

</html>

Output:

Bookstrap 5 Columns Wrapping
Bootstrap 5 Columns Wrapping

Example 2: In this example, we set and wrap the column on different screen sizes when the column increases more than 12.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">

    <link href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" 
          rel="stylesheet">
    <script src=
"https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js">
    </script>
    <script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">
    </script>
</head>

<body>
    <div class="container text-center ">
        <h1 class="text-success">GeeksforGeeks</h1>
        <h5>Bootstrap5 Columns wrapping</h5>
    </div>
    <div class="container text-center">
        <div class="row border bg-light">
            <div class="col-sm-5 text-bg-danger p-3 mb-2">
                .col-5
            </div>
            <div class="col-sm-3 text-bg-success p-3 mb-2">
                .col-3
            </div>
            <div class="col-sm-2 text-bg-primary p-3 mb-2">
                .col-2
            </div>
            <div class="col-sm-6 text-bg-secondary p-3 mb-2">
                .col-6
            </div>
            <div class="col-sm-3 text-bg-warning p-3 mb-2">
                .col-3
            </div>
            <div class="col-sm-8 text-bg-dark p-3 mb-2">
                .col-8
            </div>           
        </div>
    </div>
</body>
</html>

Output:

Reference: https://getbootstrap.com/docs/5.0/layout/columns/#column-wrapping


Next Article

Similar Reads