set equal height on multiple divs

前端 未结 5 1558
鱼传尺愫
鱼传尺愫 2020-12-21 15:49

I need to set equal height on a series of divs inside another div wrapper. The problem is that I dont want the same height on all of them. The page kind of have 3 columns an

5条回答
  •  失恋的感觉
    2020-12-21 16:44

    Since you are using jQuery, are you using the EqualHeights plugin?

    http://www.cssnewbie.com/example/equal-heights/plugin.html

    Seems like you would have some logic to know how many divs are in a row before hitting the page width, then starting a new div row with a ID. Then call

    $('#custom-id').equalheights();
    

    as many times as you need to, and that should set them all to the same height per ID.

    You could build on that too by doing an each for divs in a row, and adding their width with .width().

提交回复
热议问题