How to create five equal columns in Bootstrap ?
Creating any number of equal columns in a ‘row’ was never as easier as it is now of Bootstrap 4.0+. With the introduction of ‘flexbox’ approach to the grid system, designers don’t have to worry about adding additional CSS to make it work. Here’s how it is done.
- Approach:
- Go to the Bootstrap site and get the latest Bootstrap files onto your computer.
- Write a basic HTML template using these files.
- Once everything is set up, create a simple ‘container’ div inside <body> tag.
- Inside the ‘container’, create another div with class ‘row’ and as the name suggests, we are creating a row for handling columns. Populate the ‘row’ div with 5 divs with class ‘col’. Because Bootstrap 4.0+ grid system has now shifted to Flexbox, the columns will arrange by themselves into five equally sized DOM elements.
Example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href= <title>5 cols a row</title> <style> .row .col { height: 100px; background: green; } </style> </head> <body> <div class="container px-5 py-5"> <div class="row"> <div class="col mx-1">1</div> <div class="col mx-1">2</div> <div class="col mx-1">3</div> <div class="col mx-1">4</div> <div class="col mx-1">5</div> </div> </div> <script src= </script> <script src= </script> </body> </html> |
chevron_right
filter_none
To distinguish between the columns, a small margin is added to each of the columns.
Output:

Recommended Posts:
- How to use Bootstrap to align labels with content into 4 columns ?
- How to create Responsive Bottom Navigation Bar using Bootstrap ?
- Python | Create a Pandas Dataframe from a dict of equal length lists
- Include Bootstrap in AngularJS using ng-bootstrap
- CSS | columns Property
- CSS | Multiple Columns
- How to rename columns in Pandas DataFrame
- HTML | DOM Style columns Property
- Collapse multiple Columns in Pandas
- Difference of two columns in Pandas dataframe
- CSS | grid-template-columns Property
- CSS | grid-auto-columns Property
- How to drop one or multiple columns in Pandas Dataframe
- How to select multiple columns in a pandas dataframe
- Getting frequency counts of a columns in Pandas DataFrame
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



