ตัวเลือกประเภทองค์ประกอบ CSS ใช้เพื่อเลือกองค์ประกอบทั้งหมดของประเภท ไวยากรณ์สำหรับตัวเลือกประเภทองค์ประกอบ CSS มีดังต่อไปนี้
ไวยากรณ์
element { /*declarations*/ }
ตัวอย่าง
ตัวอย่างต่อไปนี้แสดงตัวเลือกประเภทองค์ประกอบ CSS
<!DOCTYPE html> <html> <head> <style> li { list-style: none; margin: 5px; border-bottom-style: dotted; } div { box-shadow: inset 0 0 8px plum; padding: 36px; } </style> </head> <body> <div> <pre> \(╪)(╪) /</pre> <ul> <li></li> <li></li> </ul> </div> </body> </html>
ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -
ตัวอย่าง
<!DOCTYPE html> <html> <head> <style> li { text-align: center; list-style: none; margin: 5px; padding: 5px; box-shadow: inset 0 0 15px yellowgreen; } div { box-shadow: inset 0 0 8px orange; padding: 36px; width: 30%; border-radius: 50%; } </style> </head> <body> <div> <ul> <li>Hello</li> <li>Guys</li> </ul> </div> </body> </html>
ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -