Hit enter after type your search item

Bootstrap grid columns: A plug-in for same height columns layout

The Bootstrap grid columns plug-in

The Bootstrap grid system allows creating the columns with equal width quite easily. For example, if you need three columns layout then you may use three div elements with .col-md-4 class (in each div).  If four columns in a row are required then you may use .col-md-3 class. Just distribute 12 columns grid for developing the layout.

As Bootstrap is a mobile-first platform, the columns will adjust automatically in mobile phones or tablets.

So, achieving the equal width of columns in a row in the Bootstrap-based project is not the issue. However, if you want all the columns having the same height as well, you need to manage this by custom CSS.

What if you need to have same height for all columns in each row? In this tutorial, I am going to share a light-weight jQuery based plugin that does this job for you.

It only requires adding a class (grid-columns) in the row where you want columns with the same height. The following section explains how. You may also see the live demonstration.

A demo of Bootstrap grid columns plug-in

In this demo, I have created three rows with the different number of columns. The first row contains four columns by using the col-md-3 class in each row. The second row is assigned the col-md-8 and col-md-4 classes while the third row is assigned col-md-6.

For demonstration, the content in various div elements is kept different for showing how height is adjusted.

bootstrap grid

See online demo and code

The markup:


A simple CSS class is also used in the <style> section.

For setting up this plug-in, simply download it from the Github page here. After that, include the bootstrap-grid-columns.js file after the references of Bootstrap and jQuery JS files:

  <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script>

<script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js” integrity=”sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS” crossorigin=”anonymous”></script>

<script src=”js/bootstrap-grid-columns/bootstrap-grid-columns.js”></script>

In the markup, simply use the grid-columns class in a div where the .row class is used.

What if the grid-columns class is not used?

See this demo where I have created three rows again. The third row is without the grid-columns class.

bootstrap grid colum

See online demo and code

You can see, the third row’s columns height is varied, depending on the content.

This div height required for enabling the sticky sidebar