Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrap1">
<div class="button">
  <div class="above">
    <span id="on" class="active">ON</span>
    <span id="off">OFF</span>
  </div>
</div>

<div class="round">
  <div class="divid">
    <span id="on">ON</span>
    <span id="off" class="active">OFF</span>
  </div>
</div>

<div class="slide">
  <div class="on active">ON</div>
  <div class="off back">OFF</div>
</div>

<div class="push">
  <div class="on active"><span>ON</span></div>
  <div class="off non"><span>OFF</span></div>
</div>

<div class="flip">
  <span class="active">ON</span>
  <span class="off">OFF</span>
</div>
</div>
              
            
!

CSS

              
                .wrap1 {
  width: 100%;
  height: 150px;
}
.wrap1 > div {
  display: inline-block;
  vertical-align: middle;
}
.button {
  margin: 50px;
  width: 150px;
  height: 50px;
  background: #2989D8;
  border-radius: 5px;
  border: 2px solid #2989D8;
}
.above {
  width: 150px;
  height: 50px;
  border-radius: 5px;
  box-shadow: inset -4px 0 1px 1px rgba(0,0,0,0.4);
  background: #2989d8; /* Old browsers */
background: -moz-linear-gradient(left,  #2989d8 49%, #1f4da8 50%); /* FF3.6+ */
background: -webkit-gradient(linear, left, right, color-stop(20%,#3e9be8) color-stop(49%,#2989d8), color-stop(50%,#1f4da8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #3e9be8 20%, #2989d8 49%,#1f4da8 50%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #3e9be8 20%, #2989d8 49%,#1f4da8 50%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #3e9be8 20%, #2989d8 49%,#1f4da8 50%); /* IE10+ */
background: linear-gradient(to right, #3e9be8 20%, #2989d8 49%,#1f4da8 50%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2989d8', endColorstr='#1f4da8',GradientType=0 ); /* IE6-9 */
transition: all 0.5s ease;
} 

.clicked {
  box-shadow: inset 4px 0 1px 1px rgba(0,0,0,0.4);
  background: #1f4da8; /* Old browsers */
background: -moz-linear-gradient(left,  #1f4da8 49%, #2989d8 51%, #3e9be8 80%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(49%,#1f4da8), color-stop(51%,#2989d8), color-stop(80%,#3e9be8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left,  #1f4da8 49%,#2989d8 51%,#3e9be8 80%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left,  #1f4da8 49%,#2989d8 51%,#3e9be8 80%); /* Opera 11.10+ */
background: -ms-linear-gradient(left,  #1f4da8 49%,#2989d8 51%,#3e9be8 80%); /* IE10+ */
background: linear-gradient(to right,  #1f4da8 49%,#2989d8 51%,#3e9be8 80%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1f4da8', endColorstr='#3e9be8',GradientType=1 ); /* IE6-9 */
transition: all 0.5s ease;
}
.button span {
  display: inline-block;
  font-family: Arial;
  font-size: 18px;
  padding: 16px;
  opacity: 0.3;
  padding-left: 23px;
}

.button span.active {
  opacity: 1;
  color: #fff;
}


.round {
  width: 150px;
  height: 150px;
  background: #ccc;
  border-radius: 50%;
  margin: 50px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.3), 0 0 0 8px #eee,0 0 0 12px #BE9A0E;
  
  transition: all 0.5s ease;
}
.round .divid {
  width: 200px;
  height: 100px;
  /*background: #BE9A0E;*/
  transform: rotate(45deg);
  position: absolute;
  top: -15px;
  left: 10px;
}
.divid > span {
  position: absolute;
  /*transform: rotate(-45deg);*/
  padding: 30px 90px;
  font-family: Arial;
  opacity: 0.3;
  transition: background 0.5s ease,color 0.5s ease;
}
.divid span#on {
  top: 26px;
  left: 0;
}
.divid span#off {
  top: 100px;
  left: 0;
}
.divid span.active {
  opacity: 1;
  color: #fff;
  background: #BE9A0E;
  box-shadow: 0 0 12px rgba(0,0,0,0.5);
  border: 1px solid #F7C81D;
}
.rota {
  transform: rotate(-90deg);
  transition: all 0.5s ease;
}


.slide {
  position: relative;
  background: #AA351B;
  margin: 50px;
  width: 150px;
  height: 50px;
  text-align: center;
  overflow: hidden;
  transition: all 0.2s ease;
}
.slide div {
  width: 150px;
  height: 50px;
  display: block;
  background: #F77251;
  text-align: center;
  line-height: 48px;
  position: absolute;
  font-family: Arial;
  color: #fff;
  z-index: 5;
  transition: top 0.5s ease 0.5s, transform 0.2s ease, opacity 0.5s ease;
}
.slide div.back {
  background: #E05131;
  transform: scale(0.7,0.7);
  z-index: 2;
  opacity: 0.5;
  top: 50px;
}
.slide div.active {
  opacity: 1;
  top: 0;
}

.push {
  width: 150px;
  height: 50px;
  margin: 50px;
  background: #333;
}
.push div {
  width: 22%;
  height: 50px;
  float: left;
  background: #888;
  /*border-right: 1px solid;*/
  transition: width 0.5s ease,background 0.5s ease,margin 0.5s ease,height 0.5s ease,box-shadow 1s ease;
}
.push div span {
  display: block; 
  text-align: center;
  line-height: 48px;
  font-family: Arial;
  transition: all 0.5s ease;
}
.push div.active {
  width: 78%;
  height: 58px;
  margin-top: -8px;
  background: #52D6E5;
  box-shadow: inset 0 -8px 0 0 rgba(0,0,0,0.5),0 3px 5px 0 rgba(0,0,0,0.5);
}
.push div.active span {
  opacity: 1;
}
.push div.off span {
  opacity: 0.5;
}
.push div.non {
  box-shadow: inset 0 0 5px rgba(0,0,0,0.5), inset -2px 4px 1px 0 rgba(0,0,0,0.5);
}
.push div.non span {
  opacity: 0;
}


.flip {
  width: 150px;
  height: 50px;
  overflow: hidden;
  background: #ddd;
  position: relative;
}
.flip span {
  display: block;
  width: 150px;
  height: 50px;
  font-family: Arial;
  text-align: center;
  line-height:48px;
  position: absolute;
  transform: scale(1,-1);
  z-index: 2;
  opacity: 0;
  transform-origin: top center;
  transition: all 0.2s ease-out;
}
.flip span.active {
  background: #F7A02E;
  z-index: 3;
  opacity: 1;
  transform-origin: bottom center;
  transform: scale(1,1);
}
.flip span.off {
  background: #999;
  color: #fff;
}
              
            
!

JS

              
                $('.button').click(function() {
  $(this).find('div').toggleClass('clicked');
  $(this).find('div span').toggleClass('active');
});

$('.round').click(function() {
  $(this).find('div span').toggleClass('active');
  $(this).toggleClass('rota');
});

$('.slide').click(function() {
  $(this).find('div').toggleClass('active');
  $(this).find('div').toggleClass('back');
});

$('.push').click(function() {
  $(this).find('div').toggleClass('active').toggleClass('non');
});

$('.flip').click(function() {
  $(this).find('span').toggleClass('active');
});
              
            
!
999px

Console