Adding color to label next to radio that is checked with input[type="radio"]:not(:checked) - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:attribute equals value

Description

Adding color to label next to radio that is checked with input[type="radio"]:not(:checked)

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[type="radio"]:not(:checked) + label {
   background-color:Chartreuse;
}
</style> <!--from  w w  w  . j a  va2s. co  m-->
 </head> 
 <body> 
  <input type="radio" id="color1" name="color"> 
  <label for="color1" style="background-color: red;">Red</label> 
  <input type="radio" id="color2" name="color"> 
  <label for="color2" style="background-color: green;">Green</label> 
  <input type="radio" id="color3" name="color"> 
  <label for="color3" style="background-color: blue;">Blue</label>  
 </body>
</html>

Related Tutorials