Latest web development tutorials

HTML DOM Embed width attribute

Embed Object Reference Embed the object

Examples

Modify the embedded document width is 500 pixels:

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

try it"

Definition and Usage

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

width attribute describes the embedded file width, in pixels.

Tip: Use the height property to set or return the height <embed> element.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support width attribute.


grammar

Back width attributes:

embedObject .width

Setting the width property:

embedObject .width= pixels

Property Value

描述
pixels 指定了嵌入文件的宽度,以像素计。 (例如: width="100")

technical details

return value: A Number, representing the width of the embedded content, in pixels


More examples

Examples

Returns the width of embedded files:

var x = document.getElementById("myEmbed").width;
x The output is:
200

try it"

Examples

Modify the embedded document height and width of 500 pixels:

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

try it"


Related Pages

HTML Reference Manual: HTML <the embed> width attribute


Embed Object Reference Embed the object