Example
Set the height of all p elements:
$("button").click(function(){
$("p").height(50);
}); |
Try it yourself »
|
Definition and Usage
The height() method sets or returns the height of the selected element.
Return Height
Returns the height of the FIRST matched element.
Syntax
Set Height
Sets the height of ALL
matched elements.
Syntax
Parameter |
Description |
value |
Required. Specifies the height in px, em, %,
etc. Default unit is px |
Set Height Using a Function
Using a function to set the height of ALL
matched elements.
Syntax
Parameter |
Description |
function(index,oldheight) |
Specifies a function that returns the new height of selected
elements.
- index - Optional. Receives the index position of the selector
- oldheight - Optional. Receives the current height of
the selector
|
 |
Try it Yourself - Examples |
Get
the height of the document and window elements
How to use the height() method to get the current height of the document and window
elements.
Set
the height using em and % values
How to set the height of an element using other length units.