CSS Selector Level 3 » Selected-option pseudo-class

This pseudo-class is called selected-option and will match any element which is in checked mode when the user selects the element(s), e.g. checkboxes or radiobuttons.

Syntax

Copy
:checked {
    /* declarations */
}

Example

Copy
:checked {
    opacity: 0.5;
}

Here, in this example, will change the opacity of a checked checkbox to the value of 50%.

Try example in CodePen

Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop Yes (1.0) Yes (1.0) Yes (3.0) Yes (12.0) Yes (9.0) Yes (9.0)

Please wait a moment, the comments start loading now...
explorermozillachromesafariopera