Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6159701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:10:37+00:00 2026-05-23T21:10:37+00:00

Possible Duplicate: CSS – Equal Height Columns? I have 3 divs. Like this: <div

  • 0

Possible Duplicate:
CSS – Equal Height Columns?

I have 3 divs.

Like this:

<div class="features"></div>
<div class="features"></div>
<div class="features"></div>

They are going to be filled with text. I’m not sure how much. The thing is, it’s imperative that they are all equal heights.

How can i use jQuery (or CSS) to find the tallest of the DIV’s and set the other two to the same height, creating 3 equal height DIV’s.

Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:10:37+00:00Added an answer on May 23, 2026 at 9:10 pm

    You can’t easily select by height or compare in CSS, but jQuery and a few iterations should easily take care of this problem. We’ll loop through each element and track the tallest element, then we’ll loop again and set each element’s height to be that of the tallest (working JSFiddle):

     $(document).ready(function() {
       var maxHeight = -1;
    
       $('.features').each(function() {
         maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
       });
    
       $('.features').each(function() {
         $(this).height(maxHeight);
       });
     });
    

    [Addendum]

    Sheriffderek has crafted a JSFiddle for this solution in a responsive grid. Thanks!

    [Version 2]

    Here is a cleaner version using functional programming:

    $(document).ready(function() {
      // Get an array of all element heights
      var elementHeights = $('.features').map(function() {
        return $(this).height();
      }).get();
    
      // Math.max takes a variable number of arguments
      // `apply` is equivalent to passing each height as an argument
      var maxHeight = Math.max.apply(null, elementHeights);
    
      // Set each height to the max height
      $('.features').height(maxHeight);
    });
    

    [Version 3 – sans jQuery]

    Here’s an updated version that doesn’t use jQuery (working JSFiddle):

    var elements = document.getElementsByClassName('features');
    
    var elementHeights = Array.prototype.map.call(elements, function(el)  {
      return el.clientHeight;
    });
    
    var maxHeight = Math.max.apply(null, elementHeights);
    
    Array.prototype.forEach.call(elements, function(el) {
      el.style.height = maxHeight + "px";
    });
    

    (and here it is in ES6)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Change CSS Dynamically I need to change the height of a div
Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are
Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: Avoiding repeated constants in CSS I want to include a class within
Possible Duplicate: Is there a CSS parent selector? I know this is a shot
Possible Duplicate: How to Vertically Align a Table in CSS I would like to
Possible Duplicate: How do I get this CSS text-decoration issue to work? I'm using
Possible Duplicate: Complex CSS selector for parent of active child How would I make
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.