Estilo borderTopWidth Propiedad
Ejemplo
Cambie el ancho del borde superior de un elemento <div> a 10px:
document.getElementById("myDiv").style.borderTopWidth = "10px";
Definición y uso
La propiedad borderTopWidth establece o devuelve el ancho del borde superior de un elemento.
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
borderTopWidth | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad borderTopWidth:
object.style.borderTopWidth
Establezca la propiedad borderTopWidth:
object.style.borderTopWidth = "thin|medium|thick|length|initial|inherit"
Valores de propiedad
Value | Description |
---|---|
thin | Defines a thin border |
medium | Defines a medium border. This is default |
thick | Defines a thick border |
length | The width of the border in length units |
inherit | The width of the top border is inherited from the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalles técnicos
Valor por defecto: | medio |
---|---|
Valor devuelto: | Una cadena, que representa el ancho del borde superior de un elemento |
Versión CSS | CSS1 |
Más ejemplos
Ejemplo
Cambie el ancho del borde superior de un elemento <div> a delgado:
document.getElementById("myDiv").style.borderTopWidth = "thin";
Ejemplo
Devuelve el ancho del borde superior de un elemento <div>:
alert(document.getElementById("myDiv").style.borderTopWidth);
páginas relacionadas
Tutorial de CSS: Borde CSS
Referencia CSS: propiedad border-top-width
Referencia HTML DOM: propiedad de borde
❮ Objeto de estilo