Kotak gaya , Properti Bayangan
Contoh
Tambahkan bayangan kotak ke elemen div:
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
Definisi dan Penggunaan
Properti boxShadow menyetel atau mengembalikan bayangan jatuh dari elemen kotak.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
Sintaksis
Kembalikan properti boxShadow:
object.style.boxShadow
Setel properti boxShadow:
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
Catatan: Properti boxShadow menempelkan satu atau beberapa drop-shadow ke kotak. Properti adalah daftar bayangan yang dipisahkan koma, masing-masing ditentukan oleh 2-4 nilai panjang, warna opsional, dan kata kunci sisipan opsional. Panjang yang dihilangkan adalah 0.
Nilai properti
Value | Description |
---|---|
none | Default value. No shadow is displayed |
h-shadow | Required. The position of the horizontal shadow. Negative values are allowed |
v-shadow | Required. The position of the vertical shadow. Negative values are allowed |
blur | Optional. The blur distance |
spread | Optional. The size of shadow |
color | Optional. The color of the shadow. The default value is black. Look at CSS Color Values for a complete list of possible color values. Note: In Safari (on PC) the color parameter is required. If you do not specify the color, the shadow is not displayed at all. |
inset | Optional. Changes the shadow from an outer shadow (outset) to an inner shadow |
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: | tidak ada |
---|---|
Nilai Kembali: | Sebuah String, mewakili properti kotak-bayangan dari suatu elemen |
Versi CSS | CSS3 |
Halaman Terkait
Referensi CSS: properti box-shadow
Objek Gaya