CSS :checked 选择器的作用
使用 CSS :checked 选择器为每个已选中的 <input> 元素设置样式。可以尝试运行以下代码来实现 :checked 选择器
举例
<!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>
输出
广告