Skillfully using radio to realize pure CSS tab perfect Toggle Instance

Source: Internet
Author: User
Tags inheritance relative touch

Instance One


Effect chart

<! doctype html> 


Instance two pure CSS Implement nice tab tab toggle Effects

<! doctype html> 



instance three CSS Radio tab Toggle Effects Instance page CSS code:

. test_box {    width: 50%;     min-height: 250px;  
   margin: 1em auto;
    position: relative;
}. test_tab {    width: 25%;     margin-right: -1px;
    border: 1px solid  #ccc;
    border-bottom: 0;
    float: left;
}. test_label {    display: block;     padding-top: 5px;
    padding-bottom: 5px;
    background-color:  #eee;
    text-align: center; }. Test_radio,. test_tab_content {    position: absolute;     
left: -999em; }. test_radio:checked ~ .test_tab_content {    margin-top: -1px;      padding: 1em 2em;
    border: 1px solid  #ccc;
    left: 0;
    right: 0; }. test_radio:checked ~ .test_label {    background-color:  #fff;  
   border-bottom: 1px solid  #fff;
    position: relative;
    z-index: 1; }


HTML code:

<div>     <div>         <input  Type= "Radio"  id= "TestTabRadio1"  name= "tab"  checked= "Checked"  />          <label for= "TestTabRadio1" > tab 1</label>          <div>             <p> I am the tab 1 corresponding beauty </p>                      </div>      </div>     <div>           <input type= "Radio"  id= "TestTabRadio2"  name= "tab"  />          <label for= "TestTabRadio2" > tab 2</label>       &nBsp;  <div>             <p> I am the tab 2 corresponding beauty </p>                      </div>      </div>     <div>          <input type= "Radio"  id= "TestTabRadio3"  name= "tab"  />          <label for= "TestTabRadio3" > tab 3</label>          <div>             <p> I am the tab 3 corresponding beauty </p>                      </div>     &Nbsp;</div> </div> 


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.