Get full height of element? [duplicate]

Get full height of element? [duplicate]

This question already has an answer here:

Total width of element (including padding and border) in jQuery

6 answers

My blog has a content div with an id of #content. When I select it, e.g. with Firebug it outlines the full height of the div, with all its padding and margins at the top and the bottom.
jQuery height() returns only the inner height of the element itself.
How can I query the full height of the element? If there are other elements with a lot padding and margin in them I want all of it added up and as one value.
Which method should i use?


Solution 1:

You can use outerWidth and outerHeight functions available after jQuery >= 1.3.

$(elemenet).outerHeight() will return height including height with borders and paddings

use $(element).outerHeight(true) to include margins as well.