Borde de estiloPropiedad superior
Ejemplo
Agregue un borde superior a un elemento <div>:
document.getElementById("myDiv").style.borderTop = "thick solid #0000FF";
Definición y uso
La propiedad borderTop establece o devuelve hasta tres propiedades independientes de borde superior, en forma abreviada.
Con esta propiedad, puede establecer/devolver uno o más de los siguientes (en cualquier orden):
- borde-superior-ancho
- borde-superior-estilo
- borde-superior-color
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
borderTop | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad borderTop:
object.style.borderTop
Establezca la propiedad borderTop:
object.style.borderTop = "width style color|initial|inherit"
Valores de propiedad
Parameter | Description |
---|---|
width | Sets the width of the top border |
style | Sets the style of the top border |
color | Sets the color of the top border |
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: | No especificado |
---|---|
Valor devuelto: | Una cadena, que representa el ancho, el estilo y/o el color del borde superior de un elemento |
Versión CSS | CSS1 |
Más ejemplos
Ejemplo
Cambia el ancho, el estilo y el color del borde superior de un elemento <div>:
document.getElementById("myDiv").style.borderTop = "thin dotted red";
Ejemplo
Devuelve los valores de propiedad del borde superior de un elemento <div>:
alert(document.getElementById("myDiv").style.borderTop);
páginas relacionadas
Tutorial de CSS: Borde CSS
Referencia CSS: propiedad border-top
Referencia HTML DOM: propiedad de borde
❮ Objeto de estilo