Set Border color for radio button - HTML CSS CSS Form

HTML CSS examples for CSS Form:input radio button

Description

Set Border color for radio button

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

body{<!-- w  w w.  jav  a  2 s  .c o  m-->
   margin      : 0;
   padding     : 1.5em;
}
.radiobutton{
   display: block;
}
input[type=radio   ]:not(old){
   width     : 2em;
   margin    : 0;
   padding   : 0;
   font-size : 1em;
   opacity   : 0;
}
input[type=radio   ]:not(old) + label{
   display      : inline-block;
   margin-left  : -2em;
   line-height  : 1.5em;
}
input[type=radio   ]:not(old) + label > span{
   display          : inline-block;
   width            : 0.875em;
   height           : 0.875em;
   margin           : 0.25em 0.5em 0.25em 0.25em;
   border           : 1px solid red;
   border-radius    : 0.25em;
   background       : rgb(224,224,224);
   background-image :    -moz-linear-gradient(yellow,rgb(224,224,224));
   background-image :     -ms-linear-gradient(yellow,rgb(224,224,224));
   background-image :      -o-linear-gradient(yellow,rgb(224,224,224));
   background-image : -webkit-linear-gradient(yellow,rgb(224,224,224));
   background-image :         linear-gradient(yellow,rgb(224,224,224));
   vertical-align   : bottom;
}
input[type=radio   ]:not(old):checked + label > span{
   background-image :    -moz-linear-gradient(rgb(224,224,224),yellow);
   background-image :     -ms-linear-gradient(rgb(224,224,224),yellow);
   background-image :      -o-linear-gradient(rgb(224,224,224),yellow);
   background-image : -webkit-linear-gradient(rgb(224,224,224),yellow);
   background-image :         linear-gradient(rgb(224,224,224),yellow);
}
input[type=radio]:not(old):checked +  label > span > span{
   display          : block;
   width            : 0.5em;
   height           : 0.5em;
   margin           : 0.125em;
   border           : 0.0625em solid rgb(115,153,77);
   border-radius    : 0.125em;
   background       : rgb(153,204,102);
   background-image :    -moz-linear-gradient(rgb(179,217,140),rgb(153,204,102));
   background-image :     -ms-linear-gradient(rgb(179,217,140),rgb(153,204,102));
   background-image :      -o-linear-gradient(rgb(179,217,140),rgb(153,204,102));
   background-image : -webkit-linear-gradient(rgb(179,217,140),rgb(153,204,102));
   background-image :         linear-gradient(rgb(179,217,140),rgb(153,204,102));
}


      </style> 
 </head> 
 <body> 
  <div class="radiobutton"> 
   <input id="radio1" type="radio" name="radio" value="1" checked> 
   <label for="radio1"> <span> <span></span> </span> XXXX 1 </label> 
   <input id="radio2" type="radio" name="radio" value="2"> 
   <label for="radio2"> <span> <span></span> </span> XXXX 2 </label> 
   <input id="radio3" type="radio" name="radio" value="3"> 
   <label for="radio3"> <span> <span></span> </span> XXXX 3 </label> 
  </div>  
 </body>
</html>

Related Tutorials