The Wayback Machine - https://web.archive.org/web/20241119180443/https://www.geeksforgeeks.org/bootstrap-5-columns/
Open In App

Bootstrap 5 Columns

Last Updated : 03 Jan, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Bootstrap 5 Columns facilitates the different option for the alignment, ordering, and offsetting of the Columns with the help of flexbox grid system. The different available column classes can be utilized to manage widths of non-grid elements.

Bootstrap 5 Columns: The following components is used that helps to align the columns vertically and horizontally, along with reordering them, which are described below:

  • Alignment: It utilizes flexbox alignment to order items either vertically or horizontally. It has 4 ways for alignment:
    • Vertical alignment: It is used to align items vertically.
    • Horizontal alignment: It is used to align items horizontally.
    • Column Wrapping: It is used to wrap overflowed columns into the new line.
    • Column Breaks: It is used to break columns into new line.
  • Reordering: It is used to reorder items in a column, based on the bootstrap 5 class given to the HTML elements. It has 2 for reordering:
    • Order Classes: It is used to control the visual order of the content using order class, & are responsive classes.
    • Offsetting Columns: It is used to control the order of the content using the offset grid class.
  • Standalone Column Cases: It is utilized to give an element a specific width with no padding, by default.

Syntax:

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

Example 1: In this example, we will assign different widths to columns in a row.

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1.0">
    <link href=
        rel="stylesheet"
        integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
        crossorigin="anonymous">
</head>
 
<body>
    <h1 class="text-success">
        GeeksforGeeks
    </h1>
    <h3>Bootstrap 5 Columns</h3>
 
    <div class="container">
        <div class="row">
            <div class="col-2 text-white bg-primary">
                Col 2
            </div>
            <div class="col-3 text-white bg-secondary">
                Col 3
            </div>
            <div class="col-4 text-white bg-info">
                Col 4
            </div>
        </div>
    </div>
</body>
 
</html>


Output:

 

Example 2: In this example, we will assign different ordering and widths to columns in a row.

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1.0">
    <link href=
        rel="stylesheet"
        integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
        crossorigin="anonymous">
</head>
 
<body>
    <h1 class="text-success">
        GeeksforGeeks
    </h1>
     
    <h3>Bootstrap 5 Columns</h3>
 
    <div class="container">
        <div class="row">
            <div class="col-2 text-white
                        bg-primary order-2">
                Order 2
            </div>
            <div class="col-3 text-white
                        bg-secondary order-3">
                Order 3
            </div>
            <div class="col-4 text-white
                        bg-info order-1">
                Order 1
            </div>
        </div>
    </div>
</body>
 
</html>


Output:

 

Reference: https://getbootstrap.com/docs/5.0/layout/columns/



Previous Article
Next Article

Similar Reads

Bootstrap 5 Columns Offsetting Columns
Bootstrap 5 Offsetting columns can offset grid columns in two ways, offset classes and margin utilities. Offset classes are used to match the size of columns and margin utilities are used for quick layouts. Bootstrap 5 Offsetting columns: Offset classes: This class is used to set the offset of the grid. Size is the among small (sm), medium (md), an
2 min read
How to use Bootstrap to align labels with content into 4 columns ?
The motive of this article is to align the content into four columns where the first two columns denote the labels and its content and the last two columns denote the labels and its content. The class "row" and "col" are used to create a grid which can be represented by a number of rows and columns. The class "row" creates a row into which the cont
2 min read
How to create unequal columns in Bootstrap ?
Bootstrap is a responsive framework created by Twitter. It is used to create responsive sites. It has a pre-defined class and design. In Bootstrap, we can add pre-defined classes into the code without writing code. We also have a predefined ".col" class to create columns. Grid Layout System: The whole working screen(desktop, tablet, mobile) is divi
2 min read
What are Offsetting columns in Bootstrap 3 Grid System ?
Offsetting: It looks awesome when the content of our webpage is visible on the full viewport width of the available device width. But in some cases, we have to provide some area to the components of web page around them which makes them look more awesome. So, To achieve this target bootstrap introduces us to the concept of Offsetting. Offsetting is
4 min read
Bootstrap 5 Columns Reordering
Bootstrap 5 Columns Reordering holds the feature of manipulation of column order visually and offsets grid columns. Order class is used to do the order change and offsetting is used to set the offset on the grid column. Order classes: Order classes are used to set the visual order of the columns inside a row irrespective of their position in the Do
2 min read
BootStrap 5 Grid system Auto-layout columns
Bootstrap's grid system is responsive. it's come with a flexbox and allows up to 12 columns across the page. you can also group the columns together. Auto-layout columns: To create easy column sizes without an explicit numbered class like .col-sm-6, Use breakpoint-specific column classes. Equal-width: The equal-width grid system is basically used t
2 min read
Bootstrap 5 Columns Alignment
In bootstrap 5, we can use flexbox alignment utilities to align our columns horizontally and vertically without using CSS. The following are the possible alignment ways: Vertical alignment: For aligning the column vertically we use the flexbox utilities to get desired alignment system.Horizontal alignment: For aligning the column Horizontally we us
2 min read
Bootstrap 5 Columns Horizontal Alignment
Bootstrap5 Columns Horizontal alignment is used to align the columns horizontally so that we can define how the columns will be displayed in a single line. Column Horizontal Alignment classes used: justify-content-start: This class is used to align columns from start.justify-content-center: This class is used to align columns from the center.justif
2 min read
Bootstrap 5 Columns Reordering Order Classes
Bootstrap 5 Columns Reordering Order Classes are used to set the visual order of the columns inside a row irrespective of their position in the Document Object Model. Bootstrap 5 Columns Reordering Order Classes: order-*: This class is used to set the visual order of columns in a row.order-**-*: This class sets the visual order of columns for vario
2 min read
Bootstrap 5 Columns Vertical Alignment
Bootstrap 5 Columns Vertical alignment is used to change the alignment of the column's content in the vertical direction. Bootstrap5 Columns Vertical alignment classes: align-items-start: This class is used to align the column items to the start position. align-items-center: This class is used to align the column items to the center position. align
2 min read
Bootstrap 5 Grid Columns and Gutters
Bootstrap 5 is a very popular CSS Framework, that offers a complete range of tools and elements for creating responsive and mobile-first websites. Its robust grid structure, which enables developers to make flexible and adaptable layouts, is one of its main characteristics. In this article, we will see the two tools of bootstrap5 which are grid col
3 min read
How to Create Equal Height Columns in Bootstrap ?
This article will demonstrate how to create equal-height columns in Bootstrap. We will use different approaches to achieve equal heights using the bootstrap classes and methods. Table of ContentUsing Bootstrap and FlexboxUsing Bootstrap GridsUsing Bootstrap TableApproach 1: Using Bootstrap and FlexboxIn this approach, we are using the Bootstrap and
4 min read
How to align columns in a row on text end using Bootstrap 5 ?
In this article, we will see how to align columns in a row on the text end using Bootstrap5. Bootstrap 5 provides a series of classes that can be used to apply various styling to the tables such as changing the heading appearance, making the rows striped, adding or removing borders, making rows hoverable, etc. Table of Content Using col-autoUsing c
2 min read
What is use of Columns in Bootstrap Grid System ?
In Bootstrap's grid system, columns are essential for creating responsive layouts that adapt to different screen sizes. Syntax<div class="container"> <div class="row"> <div class="col-md-4"> <!-- Content for the first column --> </div> <div class="col-md-4"> <!-- Content for the second column --> </div
2 min read
How to make a Row with 7 Equal Columns in Bootstrap ?
Bootstrap is the styling framework to make the web application more attractive. To create a row with 7 equal columns in Bootstrap, you can use the grid system by dividing the row into 12 columns and assigning each column a class such as col-1 for each of the 7 columns. This way, each column will occupy an equal portion of the row, ensuring a balanc
2 min read
How to put two columns one below other in sidebar in Bootstrap?
To place two columns one below the other in a sidebar using Bootstrap, you can use Bootstrap's grid system. By setting up a vertical stacking of columns within a sidebar container, you ensure that the columns appear one below the other. This is achieved by using a single column width and placing them within a vertical layout. ApproachIntegrate Boot
5 min read
How to Fixed One Column and Scrollable Other Column or Columns in Bootstrap?
Bootstrap provides several built-in features to the users. This makes development faster and smoother. However, in some cases, external CSS and jQuery has to be implemented to the web page's coding in order to give it a personalized touch. Usually, the Bootstrap grid is used to divide the web-page into 12 equal columns. These columns can be grouped
4 min read
How to design the bootstrap columns dynamically in PHP?
In this article, we demonstrate creating dynamic Bootstrap columns using PHP, enabling responsive layouts. You'll learn to use PHP loops and conditions to adjust column sizes based on content and screen size, ensuring flexible, adaptive web designs. We will store the data for each of the bootstrap columns in a PHP array and then loop over the array
3 min read
How to make columns stack vertically on smaller screens in React Bootstrap?
In the article, we used different components like rows, columns, etc. to display and deliver the information to the user. However, on smaller screen devices, there is an issue with the representation of these components. So, to handle the columns on the smaller screens, we can use grid classes and FlexBox classes provided by React Bootstrap. Table
3 min read
Bootstrap 5 Row Columns Gutters
Bootstrap 5 Row columns gutters are used to create responsive space in our grid in the Bootstrap 5 framework. Bootstrap 5 Row columns gutter Class: row-cols-*: This class is used to set the number of columns that best render your content and layout.Note: * can have values like 1, 2, 3, and so on. Syntax: <div class="row row-cols-2"> ...</d
2 min read
Bootstrap 5 Columns Breaks
Bootstrap 5 Columns are smaller cells or sections inside a row in a Grid System. The columns are placed beside one another until it exceeds the 12-column limit for each row. Column breaks are used if we manually want to push to the new line before or without exceeding the limit. There is no exact class that is used to make a break instead there is
2 min read
How to make Bootstrap Columns all the same Height ?
In this article, we are going to implement Columns Using React JS and Bootstrap while developing software we need to create columns of the same height that's why in this article we are going to implement multiple columns of the same height using React JS and Bootstrap. PrerequisitesReact JS BootstrapTable of Content Using column-heightUsing equal-h
3 min read
Bootstrap 5 Columns Wrapping
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,
2 min read
Bootstrap 5 Grid System Row Columns
Bootstrap 5 grid system uses rows and columns to structure content. Rows create horizontal groups, while columns divide the page width. The system offers responsive classes for layout adjustments across different screen sizes. Bootstrap 5 Grid system Row Columns Classes:Bootstrap ClassDescriptionrow-cols*To set the number of columns in a single row
2 min read
Bootstrap 5 Columns Reordering Offset Classes
Bootstrap 5 Columns Reordering Offset classes are used to give some offset to the column. The offset class sets the left margin of the column they are applied to the total width of the offset columns. Bootstrap 5 Columns Reordering Offset Classes: offset-*: This class is used to give offset to the column position.offset-**-*: This class is used to
2 min read
How to create five equal columns in Bootstrap ?
In Bootstrap, creating five equal columns means dividing a row into five evenly spaced columns. This can be achieved using the Flexbox-based grid system in Bootstrap 4+. Simply add five col elements inside a row, and Flexbox automatically distributes them equally. Approach: Download the latest Bootstrap files from the official Bootstrap website and
2 min read
How to keep Gap Between Columns using Bootstrap?
Maintaining appropriate Gaps between columns is essential for ensuring a clear, professional layout. While CSS offers various methods to manage column gaps, we will be using the Bootstrap framework to create precise and efficient spacing. The methods covered include the use of additional div elements and Bootstrap's offset class, both of which allo
2 min read
Include Bootstrap in AngularJS using ng-bootstrap
AngularJS can be integrated with Bootstrap CSS and Javascript and can be used to create creative forms, tables, navigation bars, etc. Steps: Make sure the Angular CLI present in your system if not then run the command in the terminal to do so. npm install -g @angular/cli Create a new project on visual studio code by running the code ng new project-
2 min read
Difference between bootstrap.css and bootstrap-theme.css
Bootstrap is an HTML, CSS and JS front-end-framework used for developing responsive and mobile-first projects on the web. It is the framework that comes up with predefined terms, thus giving you the ability to use these codes instead of having to create the codes from scratch. It is a collection of HTML, CSS and JS code that is designed to help bui
5 min read
Difference Between Bootstrap 3 and Bootstrap 4
Bootstrap: Bootstrap was developed by Mark Otto and Jacob Thorton at Twitter in August 2011. It is an open-source framework that is used to design responsive websites faster and easier. It is the most popular open-source framework that includes HTML, CSS, and JavaScript. It can create web applications with any server-side Technology like Java, PHP,
2 min read
three90RightbarBannerImg