Melbin Mathai
Melbin Mathai

Reputation: 507

Adjust Divs height related to another Div

I have four divs side by side. I'd like the height of them to be the same, and stay the same if one of them resizes. means, if one grows because text is placed into it, the other one should grow to match the height.

Here is my :Fiddle

Please resize the width of answer

Thank you.

Upvotes: 0

Views: 88

Answers (2)

Mayuresh Shahane
Mayuresh Shahane

Reputation: 29

$(document).ready(function(){
    var height;
    var maxHeight = 0;
    $(".test").each(function(){
        height = $(this).height();
        if(height > maxHeight) {
            maxHeight = height;
        }
    });
    $(".test").css("height",maxHeight);
});

By using jQuery

Demo Fiddle

Upvotes: 1

Dmytro Lishtvan
Dmytro Lishtvan

Reputation: 808

here is your solution you should use display:flex

jsfiddle.net/94uvouzw/7/

Upvotes: 1

Related Questions