Equal column height with jQuery

Have you ever wanted all your divs (columns) to have the same height?

With CSS is a pain in the butt, here's how jQuery comes in handy.

This very cool snippet will get the highest value for your columns. Then you can asign them all the same height.

var highestCol = Math.max($('#col-1').height(),$('#col-2').height(),$('#col-3').height()); $('.columns').height(highestCol);
Code language: JavaScript (javascript)

About Ricard Torres

Senior Front-end Software Engineer at Netcentric, from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> if you need to.