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.
:checked { style properties }
:checked |
Yes | 9.0 | Yes | Yes | Yes |
An example showing how to use :checked CSS selector.
<!DOCTYPE HTML>
<html>
<head>
<style>
:checked + span { <!-- w ww .ja v a2 s.c o m-->
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>
There is no specific selector for unchecked elements,
but you can combine :checked
with the negation selector.