คุณสมบัติ CSS list-style-image ใช้เพื่อกำหนดรูปภาพเป็นเครื่องหมายสำหรับรายการ
ไวยากรณ์
ไวยากรณ์ของคุณสมบัติ CSS list-style-image มีดังนี้ -
Selector { list-style-image: /*value*/ }
ตัวอย่าง
ตัวอย่างต่อไปนี้แสดงให้เห็นถึงคุณสมบัติ CSS list-style-image -
<!DOCTYPE html> <html> <head> <style> ul { width: 150px; list-style-image: url("https://www.tutorialspoint.com/images/Servlets.png"); background: goldenrod; } li { text-align: center; background: lavenderblush; margin: 5px 30px; } </style> </head> <body> <h2>Servlets</h2> <ul> <li>Client Request</li> <li>Server Response</li> <li>Cookies Handling</li> <li>Session Tracking</li> </ul> </body> </html>
ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -
ตัวอย่าง
<!DOCTYPE html> <html> <head> <style> ul { margin-left: 20px; list-style-image: url("https://www.tutorialspoint.com/images/hibernate.png"); } li { font-size: 1.3em; text-align: center; background: burlywood; margin: 3px; } </style> </head> <body> <h2>Hibernate Tutorial</h2> <ul> <li>Sessions</li> <li>Persistent Class</li> <li>Mapping Files</li> <li>Mapping Types</li> <li>Annotations</li> </ul> </body> </html>
ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -