English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Properties

CSS3 :checked Selector

: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

Online Example

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 ‹/›

Definition and Usage

:checked selector matches each selected input element (only applies to radio buttons or checkboxes).

Browser Compatibility

The numbers in the table indicate the first browser version that supports this attribute.

Selector




:checked4.09.03.53.29.6

Complete CSS Selector Reference Manual