Take the 2-minute tour ×

I have 2 divs and I want to make their height equal:

var highestCol = $('#SecondColumn').height();

I know that second div is always higher than first one. When there is plain text in both divs everything works fine. But after adding divs with some margin or padding into second div (always higher) the calculatio breaks. It takes height of higher div but ignores sum of all margins of child divs inside second column.

How can I calculate full div with margins/paddings?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

I think you want outerHeight(true) rather than 'height()' to include the margins/paddings.

The 'true' refers to including the margins or not.

share|improve this answer
outerHeight() and outerHeight(true) returns same height for me. –  Ockonal Mar 19 '12 at 13:00
That would suggest that the element having outerHeight called on it has no margins the API has a diagram at the top indicating what should be included - api.jquery.com/outerHeight –  dougajmcdonald Mar 19 '12 at 13:17

Please try the following from the jQuery api.


share|improve this answer

try this:

var highestCol = $('#SecondColumn')[0].offsetHeight;
share|improve this answer

Your Answer


