Embed widthProperty

Embed 对象参考手册Embed Object

Example

Set the width of the embedded file to 500 pixels:

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

Try it Yourself »

Definition and Usage

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

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

Tip:Useheightthe 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. (For example: 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;
xThe output result is:
200

Try it Yourself »

Example

Set 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


Embed 对象参考手册Embed Object Other Extensions