Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

บทบาทของ CSS :checked Selector


ใช้ CSS :checked ตัวเลือกเพื่อจัดรูปแบบทุกองค์ประกอบ ที่เลือก คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน :checked selector:

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:checked {
            height: 20px;
            width: 20px;
         }
      </style>
   </head>
   <body>
      <p>Fav sports:</p>
      <form action="">
         <input type = "checkbox" value = "Football">Football<br>
         <input type = "checkbox" value = "Cricket">Cricket<br>
         <input type = "checkbox" checked = "checked" value = "Tennis"> Tennis<br>
         <input type = "checkbox" value = "Badminton">Tennis
      </form>
   </body>
</html>

ผลลัพธ์

บทบาทของ CSS :checked Selector