Animate to highlight radiobutton with background - HTML CSS CSS Form

HTML CSS examples for CSS Form:input radio button

Description

Animate to highlight radiobutton with background

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 {<!--from w  w w.j a v a 2  s  . c  o m-->
   display: none;
}
#rdb1:checked ~ #back {
   left:0 !important;
}
#rdb2:checked ~ #back{
   left:15vw !important;
}
#rdb3:checked ~ #back{
   left:30vw !important;
}
label{
   width:15vw;
   float:left;
}
#back{
   background-color: yellowGreen;
   left:0;
   position:fixed;
   width:15vw;
   height:12pt;
   z-index:-1;
   transition:left 500ms
}


      </style> 
 </head> 
 <body> 
  <div> 
   <input type="radio" name="radioBtn" id="rdb1" checked> 
   <label for="rdb1">First Option</label> 
   <input type="radio" name="radioBtn" id="rdb2"> 
   <label for="rdb2">Second Opetion</label> 
   <input type="radio" name="radioBtn" id="rdb3"> 
   <label for="rdb3">Third Option</label> 
   <div id="back"></div> 
  </div>  
 </body>
</html>

Related Tutorials