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 radio buttons.

# 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) Yes (1) Yes (3) Yes (12) Yes (9) Yes (9)

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