Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
Bootstrap 5 Grid system Nesting
Next article icon

Bootstrap 5 Grid System Row Columns

Last Updated : 31 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

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 ClassDescription
row-cols*To set the number of columns in a single row 1 to 12 can be created.
row-cols-autoSets the size of the column according to the content
col-*This class applies to individual columns.

Syntax: 

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

<div class="row row-cols-auto">
<div class="col"> ... </div>
...
</div>

Examples of Bootstrap 5 Grid System Row Columns

Example 1: In this example we demonstrates Bootstrap 5's grid system with rows and columns. Rows are organized with predefined column widths, creating responsive layouts for content. using row-cols-2 to create two different columns and row-cols-auto to make grids of rows and columns.

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/[email protected]/dist/js/bootstrap.bundle.min.js">    </script> </head>  <body>   <div class="text-center">     <h1 class="text-success">       GeeksforGeeks     </h1>     <h2>       Bootstrap 5 Grid system Row       columns     </h2>     <br />     <div class="container">       <div class="row row-cols-2">         <div class="col border border-success">           1         </div>         <div class="col border  					border-success">           2         </div>         <div class="col border border-success">           3         </div>         <div class="col border border-success">           4         </div>         <div class="col border border-success">           5         </div>         <div class="col border border-success">           6         </div>       </div>       <br /><br />       <div class="row row-cols-auto">         <div class="col border">           GFG         </div>         <div class="col border">           HTML         </div>         <div class="col border">           CSS         </div>         <div class="col border">           Javascript         </div>         <div class="col border">           1         </div>       </div>     </div>   </div> </body>  </html> 

Output :

Bootstrap 5 Grid System Row Columns Example Output

Example 2: In this example we demonstrates Bootstrap 5's grid system with responsive column layout. Columns adjust based on screen size, ensuring a consistent and adaptive layout across devices. using row-cols-1 row-cols-sm-2 row-cols-md-4 for responsive behavior.

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/[email protected]/dist/js/bootstrap.bundle.min.js">          </script>     </head>      <body>         <div class="text-center">             <h1 class="text-success">                 GeeksforGeeks             </h1>             <h2>                 Bootstrap 5 Grid system Row                 columns             </h2>             <br />             <div class="container">                 <div                     class="row row-cols-1                             row-cols-sm-2                             row-cols-md-4"                 >                     <div class="col border">                         Column                     </div>                     <div class="col border">                         Column                     </div>                     <div class="col border">                         Column                     </div>                     <div class="col border">                         Column                     </div>                 </div>             </div>         </div>     </body> </html> 

Output :


Next Article
Bootstrap 5 Grid system Nesting

H

harshil123
Improve
Article Tags :
  • Technical Scripter
  • Web Technologies
  • Bootstrap
  • Technical Scripter 2022
  • Bootstrap-5

Similar Reads

    Breakepoints Layout

    Bootstrap 5 Breakpoints Available Breakpoints
    Bootstrap 5 provides a predefined set of different available breakpoints to build the responsive utilities which help in quickly creating responsive layouts, along with defining the range of screen size or viewport size. There are 6 default breakpoints that are facilitated by Bootstrap, which are kn
    2 min read
    Bootstrap 5 Breakpoints Min-width
    For Min-Width breakpoints, CSS would only be applied for devices larger than min-width. There are media queries and mixins for targeting segments of screen sizes using the minimum and maximum breakpoint widths. We use xs, md, lg, xl, xxl for various viewport sizes.There is no need for media query fo
    2 min read
    Bootstrap 5 Breakpoints Max-width
    For Max-width, CSS is executed for the size smaller than mentioned in the media query. There are media queries and mixins for targeting segments of screen sizes using the minimum and maximum breakpoint widths. We use xs, md, lg, xl, xxl for various viewport sizes. We often utilize media queries that
    3 min read
    Bootstrap 5 Breakpoints Single breakpoint
    We use media queries to create sensible breakpoints for our interfaces and layouts. There are media queries and mixins for targeting a single segment of screen sizes using the minimum and maximum breakpoint widths. We use xs, md, lg, xl, xxl for various viewport sizes.@include media-breakpoint-only(
    2 min read
    Bootstrap 5 Breakpoints Between Breakpoints
    We use media queries to create sensible breakpoints for our interfaces and layouts. There are media queries and mixins for targeting multiple segments of screen sizes using the minimum and maximum breakpoint widths. We use xs, md, lg, xl, xxl for various viewport sizes.@include media-breakpoint-betw
    2 min read

    Containers Layout

    Bootstrap 5 Containers Default Container
    Containers are the most fundamental layout component in Bootstrap, which is necessary if you want to use the pre-installed grid system. The purpose of containers is to hold, center(at times), and occasionally add some padding to the content they hold. Although containers can be nested, most layouts
    2 min read
    Bootstrap 5 Containers Responsive Containers
    Bootstrap 5 Containers Responsive containers are used to group HTML elements and also provide support for grid layout. It has in-built responsiveness which is helpful while development. Bootstrap 5 Responsive Container Classes:container-sm: Container small is a class that styles a container that has
    3 min read
    Bootstrap5 Containers Fluid containers
    Bootstrap 5 Fluid Containers are used to make containers that span the entire width of the screen i.e. they span the entire width of the viewport.Containers Fluid Containers Class:container-fluid: This class is used to make a fluid container.Syntax:<div class="container-fluid"> ...</div>
    2 min read
    Bootstrap 5 Containers Sass
    Bootstrap5 Containers Sass has a set of predefined container classes which makes building layouts easier. We can customize it by changing the Sass map. We can also make our own containers with Bootstrap 5 SASS mixins.Steps to override SCSS of Bootstrap:Step 1: Install bootstrap using the following c
    2 min read

    Grid system Layout

    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-widt
    2 min read
    Bootstrap 5 Grid system Equal-width
    Bootstrap 5 Grid system is a powerful mobile-first responsive flexbox grid that allows up to 12 columns across the page. You can also group the columns together. The equal-width grid system is basically used to create the grid in equal sizes. With the help of classes, we will manage the grid's width
    2 min read
    BootStrap 5 Grid system Setting one column width
    Bootstrap 5 Grid system Setting one column width is used to set the width of a specific column, it can be applied to any column. The Auto-layout for flexbox grid columns means you can set the width of one column and the sibling columns will automatically resize around it. Bootstrap 5 Grid system Set
    2 min read
    BootStrap 5 Grid System Variable Width Content
    Grid system Variable width content means in a grid system we can add a setting where the column will adjust to the content inside it and occupy that space only. In this setting, we can add responsiveness by which we can specify the screen size above which that column will have variable width with co
    2 min read
    BootStrap5 Grid system Responsive classes
    Bootstrap 5 Grid System Responsive classes offer six tiers (xs, sm, md, lg, xl) to customize column sizes, enabling the creation of responsive layouts. This allows seamless adaptation to various screen sizes for optimal user experience. Bootstrap 5 Grid system Responsive Options: ConceptDescriptionA
    3 min read
    BootStrap 5 Grid System All Breakpoints
    Bootstrap 5's grid system is a powerful tool for creating responsive layouts. It utilizes a 12-column system that adapts to various screen sizes, making it easier to design websites that look great on all devices. Let's dive deeper into how the grid system works across all breakpoints.Key Concepts:1
    4 min read
    BootStrap 5 Grid System Stacked to Horizontal
    Bootstrap 5 Grid System is a way to create layouts that are responsive and highly customizable. Grids can be arranged in a lot of different ways from which stacked vertically and placed horizontally beside each other are the most basic ones. We can use the responsive classes in a way that the classe
    3 min read
    Bootstrap 5 Grid system Mix and match
    Bootstrap 5 Grid System Mix and Match provides a way to combine the column with various available classes for each tier, in order to simply stack the columns in some grid tiers according to need, i.e., any number of columns in each row tier can be added to get the style of layout we want which at ti
    3 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-
    2 min read
    Bootstrap 5 Grid system Nesting
    Bootstrap 5 Grid system Nesting is adding rows and columns of the grid in one cell of an already existing grid. To implement nesting we need to add the .col column classes inside an already existing grid column and make a proper grid inside a single grid column. This nested grid can be also made int
    2 min read

    Columns Layout

    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 ali
    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 al
    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 cla
    2 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 t
    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 cl
    2 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 ins
    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-**-*: Thi
    2 min read
    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 g
    2 min read
    Bootstrap5 Columns Margin Utilities
    Bootstrap5 Columns Margin utilities are used to put some margin between the sibling elements such that it pushes the sibling elements away from their position. Margin utility classes: .m*-auto: This class is used to separate sibling columns Syntax: <div class=" m*-auto"> ... </div> The '
    2 min read
    Bootstrap 5 Standalone column classes
    Bootstrap5 Standalone column classes are used to give an element a specific width, where the .col-* classes can also be used outside a .row, which can be used to create the standalone column. We can even use this with clearfix wrapper class. It is generally used in float layouts where elements are f
    2 min read

    Gutters Layout

    Bootstrap 5 Vertical Gutters
    Vertical gutters: Vertical gutter is used for padding between columns, responsively space, and aligning content to the grid system. Bootstrap 5 Vertical Gutter Class: gy-*: This class is used to control the vertical widths of gutters. Note: (*) is used for numeric numbers like 1,2,3,4,.. etc. Syntax
    2 min read
    Bootstrap 5 Horizontal & Vertical Gutters
    Horizontal & vertical Gutters in bootstrap 5 are used to give padding between columns, responsively space, and align content to the grid system. Bootstrap 5 Horizontal & vertical Gutter Class: g-*: This class controls the horizontal gutter widths. Note: (*) is used for numeric numbers like 1
    2 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.Synta
    2 min read
    Bootstrap 5 No Gutters
    Bootstrap 5 No gutters remove margin and padding from .row and columns. Bootstrap 5 No gutter Class: g-0: This class is used to remove the gutter between our columns and rows. Syntax: <div class="g-0"> ... </div> Example 1: let us see an example of no gutters. HTML <!DOCTYPE html>
    1 min read
    Bootstrap 5 Change the gutters
    Bootstrap 5 Change the gutters uses $spacer to make the $gutters SASS map. The gutters are used to give padding between the columns, responsively space, and align content to the grid system. Below is the list of default values of the $gutters map: $grid-gutter-width: 1.5rem; $gutters: ( 0: 0, 1: $sp
    3 min read

    Utilities for layout

    Bootstrap 5 Utilities Flexbox Options
    Bootstrap 5 layout utility classes are a set of pre-defined classes that can be used to create responsive and flexible layouts. These classes include options for setting the width and height of elements, controlling the placement of elements using margins and padding, and arranging elements using a
    3 min read
    BootStrap 5 Utilities Margin and Padding
    In Bootstrap 5, the margin and padding utilities are used to add space around elements. The margin utilities are used to add space outside of an element, while the padding utilities are used to add space inside of an element. Bootstrap 5 Utilities Margin and padding Classes: There are no different c
    2 min read
    Bootstrap 5 UtilitiesToggle visibility
    Bootstrap 5 regulates element visibility without changing display content. In Bootstrap 5 the visibility of an element can be changed without using any display properties but by using the Utilities Toggle visibility classes. The display and layout properties of an element don't get changed due to th
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences