Examples of customizing radio, checkbox styles using CSS

Source: Internet
Author: User
Used to do custom style radio, checkbox, always the following structure

<label>    <span class= "Diyradio" >        <input type= "Radio" name= "value=" ">    </span>    <span> Text </span></label>

Then define the Diyradio style as the new radio, and then use JS to do the correlation.

I know today. can use <label></label> tags for properties +: checked, pure CSS
( really should not, learn things still need to be serious, meticulous point.) )

Examples of DIY single options are as follows:

<!--HTML--><p class= "Radio-beauty-container" > <label> <span class= "Radio-name" >radio1</span> <input type= "Radio" name= "Radioname" id= "radioName1" hidden/&        Gt <label for= "radioName1" class= "radio-beauty" ></label> </label> <label> <span class = "Radio-name" >radio2</span> <input type= "Radio" name= "Radioname" id= "radioName2" hidden/> < ; label for= "RadioName2" class= "radio-beauty" ></label> </label> <label> <span class= "R Adio-name ">radio3</span> <input type=" Radio "name=" Radioname "id=" RadioName3 "hidden/> <la Bel for= "RadioName3" class= "radio-beauty" ></label> </label></p> 
/* css */.radio-beauty-container {font-size:0;}.  Radio-beauty-container. Radio-beauty:hover,. Radio-beauty-container input[type= "Radio"]:checked +. Radio-beauty {  padding:2px;  Background-color:green; Background-clip:content-box;}.  Radio-beauty-container. radio-name {vertical-align:middle; font-size:16px;}.  Radio-beauty-container. radio-beauty {width:18px;  height:18px;  Box-sizing:border-box;  Display:inline-block;  border:1px solid Green;  Vertical-align:middle;  margin:0 15px 0 3px; border-radius:50%;}. Radio-beauty-container. radio-beauty:hover {box-shadow:0 0 7px green;} 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.