Style outlineWidthPropiedad
Objeto Style
Definición y uso
La propiedad outlineWidth establece o devuelve el ancho del contorno alrededor de un elemento.
Sintaxis
Establecer la propiedad outlineWidth:
Object.style.outlineWidth="thin|medium|thick|length|inherit"
Devolver la propiedad outlineWidth:
Object.style.outlineWidth
| Valor | Descripción |
|---|---|
| thin | Define un contorno fino. |
| medium | Predeterminado. Define un contorno medio. |
| thick | Define un contorno grueso. |
| length | Define el ancho del contorno en unidades como px, cm, etc. |
| inherit | El ancho del contorno se hereda del elemento padre. |
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad outlineWidth.
Nota:IE7 y versiones anteriores no admiten la propiedad outlineWidth. IE8 solo admite la propiedad outlineWidth si se especifica un !DOCTYPE. IE9 admite la propiedad outlineWidth.
Consejos y notas
El contorno es una línea alrededor del elemento. Se muestra alrededor del margen del elemento. Sin embargo, es diferente de la propiedad border.
El contorno no es parte de las dimensiones del elemento, por lo tanto, las propiedades width y height del elemento no incluyen el ancho del contorno.
Ejemplo
Ejemplo
Cambiar el ancho del contorno:
<html>
<head>
<style type="text/css">
#ex1
{
border:1px solid red;
outline:green dotted thick;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.outlineWidth="10px";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change outline width</button>
</body>
</html>
<head>
<style type="text/css">
#ex1
{
border:1px solid red;
outline:green dotted thick;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.outlineWidth="10px";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change outline width</button>
</body>
</html>
Pruébalo »
Objeto Style Otras extensiones