CSS3 selector for radio box group labels with no selection - HTML CSS CSS

HTML CSS examples for CSS:Selector

Description

CSS3 selector for radio box group labels with no selection

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
input + label div {
   color:Chartreuse;
}

input:checked~label div {
   color:yellow;
}

input:checked + label div {
   color:blue;
}
</style> <!--   w  w  w.  j a  va 2  s . c  o m-->
 </head> 
 <body> 
  <input id="rad1" type="radio" name="rad1" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label> 
  <input id="rad1" type="radio" name="rad1" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label> 
  <input id="rad1" type="radio" name="rad1" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label> 
  <input id="rad1" type="radio" name="rad2" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label> 
  <input id="rad1" type="radio" name="rad2" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label> 
  <input id="rad1" type="radio" name="rad2" value="1"> 
  <label for="rad1"> 
   <div>
     Lorem ips 
   </div> </label>  
 </body>
</html>

Related Tutorials