5 equal columns Bootstrap grid layout with 1, 2, 3, 4 of five

Twitter Bootstrap has 12 columns grid layout by default which allows you to create responsive layout for your website but you can’t create 5 equal columns without using offset in this setup as sum of those column never meet with 12. But in this tutorial we have created some CSS rules to make five equal columns Bootstrap grid layout. Furthermore you can also have 1/5, 2/5, 3/5 and 4/5 sized columns combined with Bootstrap 12 columns grid layout after reading  this post.

5 equal columns Bootstrap grid layout with 1, 2, 3, 4 of five

Method I: Using offset classes in Bootstrap 3.0 and above

 

 5 equal column bootstrap default

This html will make 5 equal columns with default available Twitter Bootstrap default grid system while leaving space for one column each to the left and right end. To overcome this issue, follow the next method.

Method II: Put some classes in your stylesheet

5 equal columns Bootstrap grid layout

Here we need to create default column definition in the way that Bootstrap do it. I called my classes col-XX-1-5

And need to apply media queries to handle width with varying viewport sizes as each of the column would have to occupy 20% space from available width within row:

Now we are ready to combine these classes with original Bootstrap classes. For example, if we want to create div element which behaves like five columns layout on medium screens and like four columns on smaller ones, we just need to use something like this:  

 



 

By using the example above you can extend & create a full flash 5 columns layout and use grid with 1, 2, 3, 4 of the five columns layout along with default 12 columns layout.

And HTML for the image shown in beginning is:

COLUMN 1/5
COLUMN 1/5
COLUMN 1/5
COLUMN 1/5
COLUMN 1/5

COLUMN 2/5
COLUMN 3/5

COLUMN 4/5
COLUMN 1/5

 And to combine our 5 equal columns layout with bootstrap default grid system:

Like this Post? Share
  • Randy de Decker

    You forgot the dots to show it’s a class name @
    @media (min-width: 768px) {