English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
:checked CSS pseudo-class selector represents any option HTML element ("option") within any radio ( <input type="radio">), checkbox ( <input type="checkbox">) or ("select") element that is in a selected state.
Complete CSS Selector Reference Manual
Set the background color for all selected input elements:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial(oldtoolbag.com)</title> <style> input:checked { height: 55px; width: 55px; } </style> </head> <body> <form action=""> <input type="radio" checked="checked" value="male" name="gender"> /> Male<br> <input type="radio" value="female" name="gender"> /> Female<br> <input type="checkbox" checked="checked" value="Bike"> /> Bike<br> <input type="checkbox" value="Car"> /> Car </form> </body> </html>Test to see ‹/›
:checked selector matches each selected input element (only applies to radio buttons or checkboxes).
The numbers in the table indicate the first browser version that supports this attribute.
Selector | |||||
---|---|---|---|---|---|
:checked | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |