Enabling a button after checking a checkbox with CSS - HTML CSS CSS Form

HTML CSS examples for CSS Form:input checkbox

Description

Enabling a button after checking a checkbox with CSS

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">

div {<!--from w  w  w.  j a  va  2  s.  co  m-->
   position:relative;
   text-align:center;
}
div div {
   height:100%;
   position:absolute;
   top:0;
   left:0;
   width:100%;
}
button {
   background:grey;
   color:#c0c0c0;
}
input[type=checkbox]:checked + div div {
   display:none;
}
input[type=checkbox]:checked + div button {
   background:#c0c0c0;
   color:black;
}


      </style> 
 </head> 
 <body> 
  <input id="agree" type="checkbox" name="agree"> I agree to the terms of service... 
  <div> 
   <button>Register</button> 
   <div></div> 
  </div>  
 </body>
</html>

Related Tutorials