$.fn.sameHeight = function(options, undefined) { var maxHeight = 0; $(this).each(function() { maxHeight = Math.max($(this).innerHeight(), maxHeight); }); $(this).each(function() { if ( options.attribute == undefined || options.attribute == 'height'){ $(this).height(maxHeight); } else{ $(this).css(options.attribute , maxHeight - $(this).height()); } }) }; $('.same_height h2').sameHeight({attribute:'padding-top'}); $('.same_height .resume').sameHeight({attribute:'height'});