IFrame widthPropiedad

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

Definición y uso

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

La propiedad width especifica el ancho del iframe.

Sintaxis

iframeObject.width=value

La propiedad width puede tener los siguientes valores:

Valor Descripción
pixels En píxeles (por ejemplo, "100px" o "100")
% Como porcentaje del ancho (por ejemplo, "20%")


Soporte del navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los navegadores principales admiten la propiedad width.


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