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

HTML DOM Embed width property

Embed width property

Embed Object Reference Embed object

Example

Modify the width of the embedded file to 500 pixels:

document.getElementById("myEmbed").width="500";

Try it »


Definition and Usage

The width property is used to set or return The width of the element.

The width property describes the width of the embedded file, in pixels.

Tip: Use height Use the property to set or return the height of the element.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the width property.


Syntax

Return the width property:

embedObject

.width

Set the width property:

embedObject

.width=

pixels

Attribute values

Value Description
pixels Specifies the width of the embedded file, in pixels. (e.g. width="100")

Technical Details

Return Value: A Number, representing the width of the embedded content, in pixels

More examples

Example

Return the width of the embedded file:

var x = document.getElementById("myEmbed").width;

x

The output is:

200

Try it »

Example

Modify the height and width of the embedded file to 500 pixels:

document.getElementById("myEmbed").height="500";

document.getElementById("myEmbed").width="500";

Try it »


Related pages

HTML Reference Manual: HTML width property


Embed Object Reference Embed object