Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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="switch">
  <input type="checkbox" checked>
  <label>
    <span class="fontawesome-ok"></span>
    <span class="fontawesome-remove"></span>
    <div></div>
  </label>
</div>
<div class="switch">
  <input type="checkbox">
  <label>
    <span class="fontawesome-ok"></span>
    <span class="fontawesome-remove"></span>
    <div></div>
  </label>
</div>
              
            
!

CSS

              
                /* 
Design by echojanz: 
http://dribbble.com/shots/1039179-Slide-Button?list=users
*/

/*
Technical inspiration from tutorial by Hugo Giraudel:
https://tympanus.net/codrops/2012/09/13/button-switches-with-checkboxes-and-css3-fanciness/
*/

/* Font Awesome */

@import url(http://weloveiconfonts.com/api/?family=fontawesome);


[class*="fontawesome-"]:before {
  font-family: 'FontAwesome', sans-serif;
}

/* Global styles */
*, *:after, *:before {
	box-sizing: border-box;
}

body {
	background: #f4f0f1;
	margin-top: 83px;
  width: 100%;
}

/*---Switch styles---*/

/* Checkbox hack */
.switch input {
	cursor: pointer;
	height: 100%;
	opacity: 0;
	position: absolute;
	width: 100%;
	z-index: 100;
}

/* Container */
.switch {
	height: 57px;
	margin: 23px auto;
	position: relative;
	width: 127px;
}

/* Background unchecked */
.switch label {
	background: #e9513a;
  color: #c72f18;
	border-radius: 2px;
	display: block;
	height: 100%;
	position: relative;
	transition: all .15s ease;
  width: 100%;
}

/* Slider unchecked */
.switch label div {
	background: #fff;
	border-radius: 2px;
	display: block;
	height: 45px;
	left: 6px;
	position: absolute;
	top: 6px;
	transition: all .15s ease;
  width: 53px;
	z-index: 3; 
}

/* Vertical lines on slider */
.switch label div:before {
	background: #d3d3d3;
  bottom: 0;
  box-shadow: -6px 0 0 0 #d3d3d3,
				6px 0 0 0 #d3d3d3; 
  content: '';
	display: block;
  height: 15px;
	left: 0;
	margin: auto;
  position: absolute;
  right: 0;
	top: 0;
  transition: all .15s ease;
  width: 3px;
}

/* Icon styles */
.switch .fontawesome-ok {
  font-size: 28px;
	left: 20px;
	position: relative;
  top: 13px;
	z-index: 2;
}


.switch .fontawesome-remove {
  font-size: 29px;
	left: 51px;
  position: relative;
	top: 12px;
	z-index: 2;
}

/* Checked States */
.switch input:checked~label {
	background: #2fca6c;
  color: #13ad4f;
}

.switch input:checked~label div {
	left: 67px;
}
              
            
!

JS

              
                
              
            
!
999px

Console