Same height column bootstrap 3 row responsive

后端 未结 16 1748
难免孤独
难免孤独 2020-11-30 00:04

Hi I have four divs in a bootstrap row. I want all divs in this row to have the same height and not break responsibility. I don\'t know how to do this without breaking respo

16条回答
  •  萌比男神i
    2020-11-30 00:41

    You can achieve this by using javascript. Find out the biggest height of the 4 divs and make all of them at the same height like the biggest one.

    Here is the code:

    $( document ).ready(function() {
        var heights = $(".well").map(function() {
            return $(this).height();
        }).get();
    
        maxHeight = Math.max.apply(null, heights);
    
        $(".well").height(maxHeight);
    });
    

    edit history: changed the ',' sign into ';' sign

提交回复
热议问题