- Micah Godbolt
- April 14, 2020
About the Code
Responsive Equal Height Divs
To adapt this pattern for responsive use I placed it into a function and called it each time the window was resized. One note is that you must reset the div heights before you take a new measurement.
More info: Link
- The Equal Height Rows Designers Crave – If a designer uses a box, those boxes better line up or they lose their Adobe license. Really!
- Separate heights for each row – Each row’s height is calculated separately, which works better for multi-row layouts.
- Light – This is a pretty short script and could be omitted from your mobile, one-column layout.
- Not a pure CSS solution – There are some pure CSS solutions out there, but they rely on background gradients or table displays, all of which hack around the problem, rather than really solving it. Until we get flexbox, this will have to do.
- Not 100% finished – Would like better support for subdivisions, where a div could take up space on multiple/partial rows (think Masonry)