Gaya borderTopWidth Property
Contoh
Ubah lebar batas atas elemen <div> menjadi 10px:
document.getElementById("myDiv").style.borderTopWidth = "10px";
Definisi dan Penggunaan
Properti borderTopWidth menetapkan atau mengembalikan lebar batas atas elemen.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
borderTopWidth | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti borderTopWidth:
object.style.borderTopWidth
Setel properti borderTopWidth:
object.style.borderTopWidth = "thin|medium|thick|length|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | sedang |
---|---|
Nilai Kembali: | Sebuah String, mewakili lebar batas atas elemen |
Versi CSS | CSS1 |
Lebih Banyak Contoh
Contoh
Ubah lebar batas atas elemen <div> menjadi tipis:
document.getElementById("myDiv").style.borderTopWidth = "thin";
Contoh
Kembalikan lebar batas atas elemen <div>:
alert(document.getElementById("myDiv").style.borderTopWidth);
Halaman Terkait
Tutorial CSS: Perbatasan CSS
Referensi CSS: properti border-top-width
Referensi DOM HTML: properti perbatasan
Objek Gaya