รายการ สไตล์คุณสมบัติสไตล์
ตัวอย่าง
เปลี่ยนรูปแบบของรายการ:
document.getElementById("myList").style.listStyle = "decimal inside";
ความหมายและการใช้งาน
คุณสมบัติ listStyle ตั้งค่าหรือส่งคืนคุณสมบัติรายการแยกกันสูงสุดสามรายการ ในรูปแบบชวเลข
ด้วยคุณสมบัตินี้ คุณสามารถตั้งค่า/ส่งคืนอย่างน้อยหนึ่งรายการต่อไปนี้ (ในลำดับใดก็ได้):
- รายการสไตล์ประเภท
- รายการสไตล์ตำแหน่ง
- รายการสไตล์ภาพ
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
listStyle | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ listStyle:
object.style.listStyle
ตั้งค่าคุณสมบัติ listStyle:
object.style.listStyle = "type position image|initial|inherit"
มูลค่าทรัพย์สิน
Parameter | Description |
---|---|
type | Defines the list-item marker type |
position | Positions the list-item marker |
image | Defines an image to be used as the list-item marker |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | แผ่นดิสก์นอก none |
---|---|
คืนมูลค่า: | สตริงที่แสดงถึงรูปแบบของรายการ |
เวอร์ชัน CSS | CSS1 |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
เปลี่ยนประเภทและตำแหน่งของรายการเป็น "สี่เหลี่ยมด้านใน":
document.getElementById("myList").style.listStyle = "square inside";
ตัวอย่าง
ส่งคืนสไตล์รายการ:
document.getElementById("myList").style.listStyle;
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: รายการ CSS
การอ้างอิง CSS: คุณสมบัติรายการสไตล์
❮ สไตล์วัตถุ