YouTip LogoYouTip

Prop Embed Width

HTML DOM Embed width Property

HTML DOM Embed width Property

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

Embed width Property

Example

Change the width of the embedded file to 500 pixels:

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

Try it yourself Β»


Definition and Usage

The width property sets or returns the width of the <embed> element.

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

Tip: Use the height property to set or return the height of the <embed> 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

Property 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

Get the width of the embedded file:

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

The value of x will be:

200

Try it yourself Β»

Example

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

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

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

Try it yourself Β»


Related Pages

HTML Reference: HTML <embed> width Attribute


← Dom Obj FieldsetProp Embed Type β†’