IFrame width Property
Example
Change the width of an iframe:
Description
The width property sets or returns the value of the width attribute in an iframe element.
The width attribute specifies the width of an iframe.
Tip: Use the height property to set or return the value of the height attribute in an iframe.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| width | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the width property:
Set the width property:
Property Values
| Value | Description |
|---|---|
| pixels | The width in pixels (like "100px" or just "100") |
Technical Details
| Return Value: | A String, representing the width of the iframe, in pixels |
|---|
More Examples
Example
Return the width of an iframe:
Example
Change the height and width of an iframe:
document.getElementById("myFrame").width = "400";
Related Pages
HTML reference: HTML <iframe> width attribute
❮ IFrame Object