.outerHeight() gets or sets the height of matched elements including padding and border (getter since 1.2.6; setter since 1.8). Pass true to include margin. The getter returns a unitless pixel Number.
Remember
$("div").outerHeight() // content + padding + border
$("div").outerHeight(true) // also include margin
$("div").outerHeight(100) // set outer height (1.8+)
$("div").outerHeight(100, true) // set accounting for margin
.height() → content only
.innerHeight() → content + padding
.outerHeight() → content + padding + border
.outerHeight(true)→ + margin
Measure or set the border box — never on window or document.
Select a DOM element (not window or document).
Call .outerHeight() to read content + padding + border.
Pass true when vertical margin must count too.
Pass a Number/string (or callback) to set outer height since jQuery 1.8.
Piece
Required?
Role
jQuery selection
Yes
Element(s) only — not window/document
includeMargin
Optional
true adds vertical margin
value / function
Setter only (1.8+)
New outer height (Number, string, or per-element fn)
Pseudocode
Pseudocode
function outerHeight(selection, valueOrMargin, includeMargin):
if selection is empty:
return undefined
if valueOrMargin is missing or is a Boolean:
el = first matched element
h = contentHeight + padding + border
if valueOrMargin === true: h += margin
return h
for each el in selection:
newH = valueOrMargin is function
? valueOrMargin(index, currentOuterHeight)
: valueOrMargin
set CSS height so outer box = newH
return selection
Reference
Cheat Sheet
Keep these facts handy while measuring the border box.
Measure while the element is visible. Temporary show/re-hide tricks are slow and may go away.
table
border-collapse: collapse can surprise
Shared borders on collapsed tables may make per-cell .outerHeight() look wrong. Prefer measuring the table as a whole.
fraction
Values may be fractional
Sub-pixel layouts can return numbers like 80.5. Round only when your UI needs integers.
Compatibility
Browser Support
.outerHeight() getter has shipped since jQuery 1.2.6; the setter and callback forms arrived in jQuery 1.8. Works in all modern browsers with jQuery loaded.
✓ jQuery 1.2.6+
.outerHeight()
Dimension API for content + padding + border — pass true for margin. Getter returns a unitless Number; setter accepts Number, string, or function (1.8+).
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.outerHeight()Excellent
Bottom line: Use .outerHeight() for the border box. Pass true for margin. Switch to .height() / .innerHeight() for smaller box edges.
Analysis
Performance Notes
Approach
Cost
Best for
.outerHeight()
Layout read
Border-box math
.outerHeight(true)
Layout read
Space including margin
Repeated reads in a loop
Can thrash layout
Cache the Number first
Dimension getters force layout. Read once, reuse the Number, and avoid calling .outerHeight() inside tight loops unless needed.
Remember
Key Takeaways
Role: get/set height including padding and border.
Margin: pass true when spacing must count.
Box ladder:height → innerHeight → outerHeight.
Scope: elements only — use .height() for window/document.
One line:.outerHeight() is the border box — pass true for margin, set since 1.8, and leave window/document to .height().
Frequently Asked Questions
.outerHeight() with no arguments returns the height of the first matched element including padding and border as a unitless pixel Number. Pass true to include margin. .outerHeight(value) or .outerHeight(function) sets that outer height on every matched element (since 1.8).
.height() is content only. .innerHeight() adds padding. .outerHeight() adds padding and border. .outerHeight(true) also includes margin. All getters return unitless Numbers.
No. The API is for elements only. Use $(window).height() for the viewport and $(document).height() for the full page.
The getter has been available since jQuery 1.2.6. The setter .outerHeight(value) and the callback form arrived in jQuery 1.8.
Calling .outerHeight() on an empty jQuery set returns undefined (null before jQuery 3.0). Always check that your selection matched something before using the Number.
No. Values can be wrong (often 0) when the element or a parent is hidden. Measure while visible. Fractional pixels are possible — do not assume an integer.