IFrame heightPropiedad

Frame/IFrame 对象参考手册Objeto Frame/IFrame

Definición y uso

La propiedad height establece o devuelve el valor del atributo height en un elemento iframe.

La propiedad height especifica la altura del iframe (en píxeles o porcentaje).

Sintaxis

iframeObject.height=value

La propiedad height puede tener los siguientes valores:

Valor Descripción
pixels La unidad de la propiedad height puede ser píxeles (como "100px" o "100")
% La unidad de la propiedad height puede ser porcentaje (como "20%")


Compatibilidad del navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los navegadores principales admiten la propiedad height


Ejemplo

Ejemplo

Cambiar la altura y el ancho del iframe:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de novatos (example.com)</title>
<script>
function changeSize(){
    document.getElementById("myframe").height="300";
    document.getElementById("myframe").width="300";
}
</script>
</head>
<body>
    
<iframe id="myframe" src="../index.html" height="200" width="200">
<p>Tu navegador no soporta iframes.</p>
</iframe>
<br><br>
<input type="button" onclick="changeSize()" value="Cambiar tamaño">

</body>
</html>

Pruébalo »


Frame/IFrame 对象参考手册Objeto Frame/IFrame Otras extensiones