Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery outerHeight() method

jQuery outerHeight() method

jQuery HTML/CSS methods jQuery HTML/CSS methods

Example

Return

The outer height of the element:

$

(

"

button

"

)

.

click

(

function

(

)

{

alert

(

$

(

"

div

"

)

.

outerHeight

(

)

)

;

}

)

;

Try it »


Definition and Usage

The outerHeight() method returns the outer height of the first matched element.

As shown in the image below, this method includes padding and border.

**Tip:** To include the margin, use outerHeight(true).

jQuery Dimensions


Related methods:

  • width() - Sets or returns the width of an element
  • height() - Sets or returns the height of an element
  • innerWidth() - Returns the width of an element (including padding)
  • innerHeight() - Returns the height of an element (including padding)
  • outerWidth() - Returns the width of an element (including padding and border)

Syntax

$(

selector

).outerHeight(

includeMargin

)

Parameters Description
includeMargin Optional. A boolean that specifies whether to include the margin.
  • false - Default. Does not include the margin.
  • true - Includes the margin.
  • |

    More examples

    Including the margin
    Specifies whether to include the margin.

    Display dimensions with related methods
    How to use width(), height(), innerHeight(), innerWidth(), outerWidth(), and outerHeight().


    jQuery HTML/CSS methods jQuery HTML/CSS methods