cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="container">
    <input type="radio"  id="radio1" name="radio" />
    <label class="circle" for="radio1" id="label1"></label>
    <input type="radio"  id="radio2" name="radio" />
    <label class="circle" for="radio2" id="label2"></label>
    <input type="radio" id="radio3" name="radio"  />
    <label class="circle" for="radio3" id="label3"></label>   
    <div class="background"></div>
    <div class="dot"></div>
</div>
            
          
!
            
              .container {
  width: 300px;
  height: 300px;
  position: absolute;
  overflow: hidden;
}

/*Don't show the normal radio buttons*/
input[type="radio"] {
  opacity: 0;
}

/*But instead use the labels so they can be styled*/
input[type="radio"] + label {
  box-sizing: border-box;
  width: 50px;
  height: 50px;
  border: solid 2px white;
  position: absolute;
  display: inline-block;
  border-radius: 50%;
  top: 111px;
  left: 50px;
/*Make sure the buttons are on top of the background and behave like buttons when you hover*/
  z-index: 1;
  cursor: pointer;
}

#label2 {
  left: 125px;
}

#label3 {
  left: 200px;
}

.background {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #3498db;
    width: 300px;
    height: 300px;
    border-left: 300px solid #9b59b6;
    border-right: 300px solid #1abc9c;  
    transition: 1s;
}

/*Move the background class (sibling of the radio button) when a radio button is checked*/
#radio1:checked ~ .background {
  transform: translateX(0px);
}

#radio2:checked ~ .background {
  transform: translateX(-300px);
}

#radio3:checked ~ .background {
  transform: translateX(-600px);
}

/*Make the dots to fill the buttons and move them too*/
.dot {
    position: relative;
    box-sizing: border-box;
    width: 35px;
    height: 35px;
    background: white;
    border-radius: 50%;
    transition: 1s;
    top: 100px;
    left: 57px; 
}

#radio1:checked ~ .dot {
    transform: translateX(0px);
}
#radio2:checked ~ .dot {
    transform: translateX(75px);
}
#radio3:checked ~ .dot {
    transform: translateX(150px);
            
          
!
999px
Loading ..................

Console