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.

            
              <input type="checkbox" id="switch"/>
<label class="toggle" for="switch">
  <div class="a">♣</div>
  <div class="b">☺</div>
</label>

<input type="checkbox" id="switch1"/>
<label class="toggle1" for="switch1">
  <div class="a">☺</div>
  <div class="b">♥</div>
</label>

            
          
!
            
              body {
  background : #1b1b1b;      
}
.toggle , .toggle1{
  cursor  : pointer;
  display : block;
  width   : 130px;
  height  : 130px;
  position: relative;
}

.toggle {
  float : left;
  margin: 30px 0 0 400px;
}

.toggle1 {
  float : right;
  margin: 30px 400px 0 0;
}

.a , .b{
  position : absolute;
  top   : 0;
  left  : 0;
  width : 130px;
  height: 130px;
  background  : #b1bb1b;
  text-align  : center;
  font-size   : 90px;
  line-height : 130px;
  font-family : georgia;
  font-weight : bold;
  color       : #1b1b1b;
  border-radius : 15px;
  border : 2px dotted rgba(0,0,0,.5);
  text-shadow : 1px 1px 0 rgba(250, 250, 250, 0.5);
}

.a {
  z-index : 1;
}

.b {
  background : #b1bbfb;
  z-index : 2;
}

#switch , #switch1 {
  position: absolute;
  left: -9999px;
}


#switch:checked ~ .toggle .b {
  animation : move-r 1s both;
}


#switch:not(:checked) ~ .toggle .b{
  animation : move-l 1s both;
}


@keyframes move-r {
  40% {
    transform : rotate(500deg) scale(1.1);
    left : 130%;
  }
  
  100% {
    left    : 0;
    z-index : -1;
  }
  
}


@keyframes move-l {
  
  0% {
    -webkit-transform : rotate(0deg);
    left    : 0;
    z-index : -1;
  }
  
  50% {
    transform : rotate(900deg) scale(.6);
    left    : -130%;
    z-index : -1;
  }
  
  100% {
    left    : 0;
    z-index : 2;
  } 
}

/* toggle1 */

#switch1:checked ~ .toggle1 .b {
  animation : move 1s both;
}

#switch1:checked ~ .toggle1 .a {
  animation : face 1s both;
}


#switch1:not(:checked) ~ .toggle1 .a{
  animation : move 1s both;
}

#switch1:not(:checked) ~ .toggle1 .b{
  animation : face 1s both;
}


@keyframes move {
  0% {
    z-index : 3;
  }
  50% {
    transform : rotate(15deg) scale(.6);
    left    : 130%;
    z-index : 3;
  }
  100% {
    left    : 0;
    z-index : 0;
  }
}

@keyframes  face {
  to {
    z-index : 3;
  }
}
            
          
!
999px
Loading ..................

Console