IFrame height Property
Example
Change the height of an iframe:
document.getElementById("myFrame").height = "400";
Try it yourself »
Definition and Usage
The height property sets or returns the value of the height attribute in an iframe element.
The height attribute specifies the height of an iframe.
Tip: Use the width property to set or return the value of the width attribute in an iframe.
Browser Support
The height property is supported in all major browsers.
Syntax
Return the height property:
iframeObject.height
Set the height property:
iframeObject.height=pixels
Property Values
Value | Description |
---|---|
pixels | The height in pixels (like "100px" or just "100") |
Technical Details
Return Value: | A String, representing the height of the iframe, in pixels |
---|
More Examples
Example
Return the height of an iframe:
var x = document.getElementById("myFrame").height;
The result of x will be:
200
Try it yourself »
Example
Change the height and width of an iframe:
document.getElementById("myFrame").height = "400";
document.getElementById("myFrame").width = "400";
Try it yourself »
Related Pages
HTML reference: HTML <iframe> height attribute
IFrame Object