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%.
# 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...