Embed width attribute

Definition and usage

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

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

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

See also:

Manual de referencia de HTML:Etiqueta <embed> de HTML

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 pixels

Attribute value

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

Detalles técnicos

Valor de retorno: Número, que representa el ancho del contenido incrustado en píxeles.

Compatibilidad del navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Soporte Soporte Soporte Soporte Soporte

Páginas relacionadas

Manual de referencia de HTML:Atributo width del <embed> de HTML