Style borderTopPropiedad
Objeto Style
Definición y uso
La propiedad borderTop establece o devuelve tres propiedades independientes del borde superior en forma abreviada.
Con esta propiedad, puede establecer/devolver:
- border-top-width
- border-top-style
- border-top-color
Sintaxis
Establecer la propiedad borderTop:
Object.style.borderTop="width style color"
Devolver la propiedad borderTop:
Object.style.borderTop
Consejo:La propiedad borderTop no tiene valor predeterminado.
| Parámetro | Descripción |
|---|---|
| width | Establece el ancho del borde superior. |
| style | Establece el estilo del borde superior. |
| color | Establece el color del borde superior. |
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales soportan la propiedad borderTop.
Ejemplo
Ejemplo
Cambia el ancho, estilo y color del borde superior:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<style type="text/css">
#ex1{
border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderTop="thick solid #0000FF";
}
</script>
</head>
<body>
<div id="ex1">Este es un texto.</div>
<br>
<button type="button" onclick="displayResult()">Modificar borde superior</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<style type="text/css">
#ex1{
border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderTop="thick solid #0000FF";
}
</script>
</head>
<body>
<div id="ex1">Este es un texto.</div>
<br>
<button type="button" onclick="displayResult()">Modificar borde superior</button>
</body>
</html>
Pruébalo »
Objeto Style Otras extensiones