Introduction
Here, in this write-up, we are going to learn how to match the height of the tallest of the rows by adjusting the column height. Why do we want to learn this? That is because when we have more than one columns that should appear side by side, we often want them to be of equal height to make them responsive and look nice. As a developer, we would face this scenario during the development. We can achieve this using bootstrap or custom CSS in our application but it can be done to the static layout or defined height. Just assume we have defined the layout with one div and appending the columns and rows in runtime. In the meantime, it will not get the chance to know that height. Here, we can achieve this using matchHeight.js without writing any CSS. Okay! Let's move forward. We will see the process with examples.
Prerequisites
- Visual Studio
- Basic knowledge of ASP.NET MVC
- Basic knowledge of jQuery
- Basic knowledge of CSS
Article Flow
- Create a View for an example
- Features of matchHeight.js
- Configure matchHeight.js with our web application
Create a View for this example
- @{
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <style>
- h2,
- p {
- color: white;
- }
- </style>
- <br />
- <div class="row">
- <div>
- <div class="col-md-4" style="background-color:teal;border:double;border-color:white">
- <img src="~/Content/Images/Image-2.png" width="100%" />
- <h2>MAHESH CHAND</h2>
- <p>BIO <br> C# Corner Founder, Author, International Speaker, and Startup Adviser. My role as the CEO of Mindcracker Inc, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.</p>
- </div>
- <div class="col-md-4" style="background-color:burlywood;border:double;border-color:white">
- <img src="~/Content/Images/Image-1.png" width="100%" />
- <h2>GNANAVEL SEKAR</h2>
- <p>BIO <br>Gnanavel Sekar has 4+ yrs experience in IT industry as a Sr.Software Engineer and C# Corner MVP. he have strong skill in C#,ASP.NET,MVC,WEB-API,C3 Charts, OrchardCMS,Docusign,Jquery,SqlServer,HTML5,CSS,EntityFramework,Swagger. Fan of Microsoft Technologies and hard core fan of Agriculture.He love challenges.</p>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-4" style="background-color:orange;">
- <img src="~/Content/Images/test1.jpg" />
- <h2>MAHESH CHAND</h2>
- <p>BIO <br>Gnanavel Sekar has 4+ yrs experience in IT industry as a Sr.Software Engineer and C# Corner MVP. he have strong skill in C#,ASP.NET,MVC,WEB-API,C3 Charts, OrchardCMS,Docusign,Jquery,SqlServer,HTML5,CSS,EntityFramework,Swagger. Fan of Microsoft Technologies and hard core fan of Agriculture.He love challenges.</p>
- </div>
- <div class="col-md-4" style="background-color:chocolate;">
- <img src="~/Content/Images/test2.jpg" />
- <h2>GNANAVEL SEKAR</h2>
- <p>Hello <br><br><br>This is not what it <br>looks like</p>
- </div>
- </div>
Run your application.
In the below image, you can see that we have created two rows and two columns and for each row, the columns differ in the height of the image and text. The below layout is developed using Bootstrap and HTML.

Features of matchHeight.js
- It matches the heights for groups of elements automatically.
- It uses the maximum height or defines a specific target element.
- We can use it anywhere on the page and anywhere in the DOM.
- Responsive (updates on window resize event).
- Handles the images and other media (updates after loading).
- Easily removable when needed.
- Maintains scroll position.
Configure matchHeight.js with our web application
Step 1 - Install matchHeight from NuGet
Step 2 - Include the library
Finally, include the library with a script tag in your document (note that jQuery needs to be included beforehand).
- <script src="~/Scripts/jquery.matchHeight.js"></script>
Use the below link if you want to download it directly.

Join the conversation! Your thoughts help the community grow.