Checked Elements with :check
Radio buttons and check boxes that are checkable can be selected through the :checked selector. You can combine :checked with the negation selector to select unchecked elements.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style>
:checked + span {
background-color: red;
color: white;
border: medium solid black;
}
</style>
</head>
<body>
<form method="post" action="http://yourServer/form">
<input type="checkbox" id="myID" name="myName"/>
</form>
</body>
</html>
Home
HTML CSS Book
CSS
HTML CSS Book
CSS
Pseudo Selectors:
- ::first-line Selector
- ::first-letter Selector
- :before Selector
- :after Selector
- CSS Counter Feature
- :root Selector
- Child Selectors
- :first-child Selector
- :last-child Selector
- :only-child Selector
- :only-of-type selector
- :nth-child(n)
- :nth-last-child(n)
- :nth-of-type(n)
- :nth-last-of-type(n)
- Enabled Elements with :enabled
- Disabled Elements with :disabled
- Checked Elements with :check
- Default Elements with :default
- Valid Elements with :valid
- Invalid input Elements with :invalid
- :in-range selector
- :out-of-range selector
- :required selector
- :optional selector
- :link selector matches hyperlinks.
- :visited selector matches visited hyperlinks.
- :hover Selector
- :active Selector
- :focus Selector
- Negation Selector not
- :empty Selector
- :lang Selector
- :target Selector
Related: