กล่อง สไตล์คุณสมบัติเงา
ตัวอย่าง
เพิ่ม box-shadow ให้กับองค์ประกอบ div:
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
ความหมายและการใช้งาน
คุณสมบัติ boxShadow ตั้งค่าหรือส่งคืนเงาแบบหล่นขององค์ประกอบกล่อง
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ boxShadow:
object.style.boxShadow
ตั้งค่าคุณสมบัติ boxShadow:
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
หมายเหตุ:คุณสมบัติ boxShadow แนบเงาดรอปอย่างน้อยหนึ่งภาพลงในกล่อง คุณสมบัตินี้เป็นรายการเงาที่คั่นด้วยเครื่องหมายจุลภาค โดยแต่ละรายการระบุด้วยค่าความยาว 2-4 สีที่ไม่บังคับ และคีย์เวิร์ดที่ใส่หรือไม่ก็ได้ ความยาวที่ละเว้นคือ 0
มูลค่าทรัพย์สิน
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 |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | ไม่มี |
---|---|
คืนมูลค่า: | A String แทนคุณสมบัติ box-shadow ขององค์ประกอบ |
เวอร์ชัน CSS | CSS3 |
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: คุณสมบัติ box-shadow
❮ สไตล์วัตถุ