CSS Selector :checked

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.


CSS Version

CSS Syntax

:checked { 
   style properties 

Browser compatibility

:checked Yes 9.0 Yes Yes Yes


An example showing how to use :checked CSS selector.

        :checked + span { <!-- w  ww .ja v  a2  s.c o m-->
            background-color: red; 
            color: white; 
            border: medium solid black; 
        <form method="post" action="http://yourServer/form"> 
            <input type="checkbox" id="myID" name="myName"/> 

Click to view the demo

There is no specific selector for unchecked elements, but you can combine :checked with the negation selector.