[CSS Selector] E:checked
'selector:checked' applies styles to elements that are checked, and is commonly referred to as a 'state pseudo-class'. It does not work in IE8 and earlier.
Since it applies to checked elements, it is mainly used with '' (checkboxes) or '' (radio buttons).
Sample Code
input:checked + p { color: red;} /* Makes the sibling p element red when checked. */
Browser Preview
input:checked + p { color: red;} /* Makes the sibling p element red when checked. */
<input type="checkbox"> <p>Color changes when checked.</p> <input type="radio"> <p>Color changes when checked.</p>
Browser Support
Desktop
2 and earlier ×Supported in all versions
8 ×
7 ×
6 ×
8 and earlier ×Mobile
1 and earlier ×
Android Browser
2+ ○Same support as desktop
Same support as desktop
※ Version data based on MDN.
If you find any errors or copyright issues, please contact us.