27

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?

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
matt
  • 42,713
  • 103
  • 264
  • 397

1 Answers1

51

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.

tausun
  • 2,154
  • 2
  • 24
  • 36