Propriété borderTop de style
Exemple
Ajoutez une bordure supérieure à un élément <div> :
document.getElementById("myDiv").style.borderTop = "thick solid #0000FF";
Définition et utilisation
La propriété borderTop définit ou renvoie jusqu'à trois propriétés border-top distinctes, sous une forme abrégée.
Avec cette propriété, vous pouvez définir/retourner un ou plusieurs des éléments suivants (dans n'importe quel ordre) :
- border-top-width
- border-top-style
- border-top-color
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
borderTop | Yes | Yes | Yes | Yes | Yes |
Syntaxe
Renvoyez la propriété borderTop :
object.style.borderTop
Définissez la propriété borderTop :
object.style.borderTop = "width style color|initial|inherit"
Valeurs de propriété
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 |
Détails techniques
Valeur par défaut: | non spécifié |
---|---|
Valeur de retour : | Une chaîne, représentant la largeur, le style et/ou la couleur de la bordure supérieure d'un élément |
Version CSS | CSS1 |
Plus d'exemples
Exemple
Modifiez la largeur, le style et la couleur de la bordure supérieure d'un élément <div> :
document.getElementById("myDiv").style.borderTop = "thin dotted red";
Exemple
Renvoie les valeurs de propriété border-top d'un élément <div> :
alert(document.getElementById("myDiv").style.borderTop);
Pages connexes
Tutoriel CSS : Bordure CSS
Référence CSS : propriété border-top
Référence HTML DOM : propriété border
❮ Objet de style