Attribut width d'IFrame
Definition and usage
width
Attribute setting or returning the iframe element width attribute value.
The width attribute specifies the width of the iframe.
Hint:Tip: height attribute Set or return the height of the iframe height attribute value.
Example
Example 1
Change the width of the iframe:
document.getElementById("myFrame").width = "400";
Example 2
Return the width of the iframe:
var x = document.getElementById("myFrame").width;
Example 3
Change the height and width of the iframe:
document.getElementById("myFrame").height = "400"; document.getElementById("myFrame").width = "400";
Syntax
Return the width attribute:
iframeObject.width
Set the width attribute:
iframeObject.width = pixels
attribute value
value | description |
---|---|
pixels | Largeur en pixels (comme "100px" ou simplement "100"). |
Détails techniques
Valeur de retour : | Valeur en chaîne, indiquant la largeur de l'iframe en pixels. |
---|
Support du navigateur
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Pages associées
Manuel de référence HTML :Attribut width de <iframe> HTML