Create equal height li blocks irrespective of the content

Posted By : Milind Ahuja | 19-Aug-2016

This blog discuss a method to creat equal height li blocks or columns irrespective of the content inside each li column that work on almost all major browsers. Basically, we create a layout in which all the li columns assume the height of the tallest column.

  

In this method we are going to create a normal ul li list which is enclosed in a div.  The enclosing div is given a display: table and each enclosed li is given a display:table-cell attribute.

I'll discuss this an example:

Here is the markup for this method: 

  • Some Content...
  • Some different content...
  • Some more content...
  • Again some other content...

Here's the CSS: 

           .row{
	          display: table;
            }
            .row ul {
                display: inline-flex;
            }
           .row ul li {
               display: table-cell;
              float: none;
           }
        

Advantage: 

This method is very easy to implement than other method using Javascript which saves lot of time and lines of code.

Disadvantage: 

This method doesn't work in few versions of IE.

THANKS

About Author

Author Image
Milind Ahuja

Milind is a bright Lead Frontend Developer and have knowledge of HTML, CSS, JavaScript, AngularJS, Angular 2+ Versions and photoshop. His hobbies are learning new computer techniques, fitness and interest in different languages.

Request for Proposal

Name is required

Comment is required

Sending message..