IFrame height attribute
Definition and usage
Height
The attribute sets or returns the height of the iframe element Height attribute value.
Height
The attribute specifies the height of the iframe.
Tip:Use Width attribute Set or return the height of the iframe Width attribute value.
Example
Example 1
Change the height of the iframe:
document.getElementById("myFrame").height = "400";
Example 2
Return the height of the iframe:
var x = document.getElementById("myFrame").height;
Example 3
Change the height and width of the iframe:
document.getElementById("myFrame").height = "400"; document.getElementById("myFrame").width = "400";
Syntax
Return the height attribute:
iframeObject.height
Set the height attribute:
iframeObject.height = pixels
Attribute value
Value | Description |
---|---|
pixels | Hauteur en pixels (par exemple "100px" ou simplement "100"). |
Détails techniques
Valeur de retour : | Valeur en chaîne, représentant la hauteur de l'iframe en pixels. |
---|
Compatibilité des navigateurs
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Pages associées
Manuel de référence HTML :Propriété height de l'élément <iframe> HTML