Thuộc tính list-style trong CSS được dùng để chỉ định list-style-type, list-style-position và list-style-image cho một phần tử.
Cú pháp
Cú pháp của thuộc tính CSS list-style như sau:
Selector { list-style: /*giá trị*/ }
Ví dụ
Các ví dụ sau minh họa việc tạo kiểu cho danh sách:
<!DOCTYPE html> <html> <head> <style> body { font-size: 1.33em; background: linear-gradient(to right, orange, lightgreen, lightblue); } ol:first-of-type { box-shadow: inset 0 0 23px rgb(20,255,40); list-style: upper-alpha inside; } ul { list-style: circle; } </style> </head> <body> <ol> <li>Demo</li> </ol> <ol> <li>Demo</li> </ol> <ul> <li>demo</li> <ol> <li>demo</li> </ol> </ul> </body> </html>
Kết quả
Đoạn mã trên cho kết quả sau:

Ví dụ khác
<!DOCTYPE html> <html> <head> <style> ol { width: 40%; list-style: lower-roman; } li { border: thin solid hotpink; margin: 5px 30px; } </style> </head> <body> <h2>Các môn thể thao phổ biến</h2> <ol> <li>Bóng đá</li> <li>Cricket</li> <li>Quần vợt</li> <li>Bóng chuyền</li> <li>Bóng rổ</li> </ol> </body> </html>
Kết quả
Đoạn mã trên cho kết quả sau:
