Embed width attribute

Definition and usage

width Attribute setting or returning the value of the width attribute of the <embed> element.

<embed> width attribute Define the width of embedded content in pixels.

Hint:Tip: height attribute Set or return the width of the <embed> element. height attribute value.

See also:

HTML Reference Manual:HTML <embed> Tag

Example

Example 1

Change the width of the embedded file to 500 pixels:

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

Try it yourself

Example 2

Return the width of the embedded file:

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

Try it yourself

Example 3

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

Syntax

Return the width attribute:

embedObject.width

Set the width attribute:

embedObject.width = pixels

Attribute value

Value Description
pixels Define the width of embedded content in pixels (for example, width="100").

Technical Details

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

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <embed> width Attribute