Skip to content

Instantly share code, notes, and snippets.

@carlos-sanchez
Created November 15, 2013 00:17
Show Gist options
  • Save carlos-sanchez/7476879 to your computer and use it in GitHub Desktop.
Save carlos-sanchez/7476879 to your computer and use it in GitHub Desktop.
Equalize heights of div elements. Equalizing heights of div elements is not possible (or very hacky) to do in pure CSS, so jQuery is here to help. The code below will automatically adjust the heights of div elements according to the higher one. Take a look at this alternative JQuery plugin: http://tsvensen.github.io/equalize.js/
var maxHeight = 0;
$("div").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div").height(maxHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment