Stile proprietà borderTop
Esempio
Aggiungi un bordo superiore a un elemento <div>:
document.getElementById("myDiv").style.borderTop = "thick solid #0000FF";
Definizione e utilizzo
La proprietà borderTop imposta o restituisce fino a tre proprietà border-top separate, in forma abbreviata.
Con questa proprietà, puoi impostare/restituire uno o più dei seguenti (in qualsiasi ordine):
- larghezza del bordo superiore
- stile bordo superiore
- colore bordo superiore
Supporto del browser
Property | |||||
---|---|---|---|---|---|
borderTop | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisci la proprietà borderTop:
object.style.borderTop
Imposta la proprietà borderTop:
object.style.borderTop = "width style color|initial|inherit"
Valori di proprietà
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 |
Dettagli tecnici
Valore di default: | non specificato |
---|---|
Valore di ritorno: | Una stringa, che rappresenta la larghezza, lo stile e/o il colore del bordo superiore di un elemento |
Versione CSS | CSS1 |
Altri esempi
Esempio
Modifica la larghezza, lo stile e il colore del bordo superiore di un elemento <div>:
document.getElementById("myDiv").style.borderTop = "thin dotted red";
Esempio
Restituisce i valori della proprietà del bordo superiore di un elemento <div>:
alert(document.getElementById("myDiv").style.borderTop);
Pagine correlate
Tutorial CSS: Bordo CSS
Riferimento CSS: proprietà border-top
Riferimento HTML DOM: proprietà border
❮ Oggetto stile