Responsive Equal Height Rows

Responsive Equal Height Rows

See the Pen Responsive Equal Height Divs by Micah Godbolt (@micahgodbolt) on CodePen.

Author

  • Micah Godbolt
  • April 14, 2020

Made with

  • HTML / CSS / JavaScript

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

Dependency: styles.css, jquery.min.js

Responsive: Yes

Pros

  • 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.

Cons

  • 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)
Maddy
12+ years of solution-driven experience, excelling in highly collaborative work environment, finding solutions to challenges and focused on customer satisfaction. Proven experience developing user-friendly web/mobile applications. Experience in applying DevOps automation integrating with Cloud solutions, following Agile principles.