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

              
                <header>
  <h1>ANIMATED TOGGLES! <span>Fun exapmple of what we can do with just CSS, to make boring input elements fun again!!</span></h1>
</header>

<section>        

    <form>

      <fieldset name="checkboxes">
        <legend>Checkbox</legend>
        <input id='check-1' type="checkbox" name='apples' checked='checked' />
        <label for="apples">Apples</label>

        <input id='oranges' type="checkbox" name='check-1' />
        <label for="oranges">Oranges</label>

        <input id='bananas' type="checkbox" name='check-1' />
        <label for="bananas">Bananas</label>

        <input id='mangoes' type="checkbox" name='check-1' />
        <label for="mangoes">Mangoes</label>
      </fieldset>


      <fieldset name="radio">
        <legend>Radio Boxes</legend>
        <input id='day' type="radio" name='radio-am-pm' checked='checked' />
        <label for="day">Day</label>

        <input id='night' type="radio" name='radio-am-pm' />
        <label for="night">Night</label>
      </fieldset>

      <fieldset name="toggles">
        <legend>Toggles</legend>
        <input class='toggle' type="checkbox" name='toggle-1' checked='checked' />
        <input class='toggle' type="checkbox" name='toggle-2' />
        <input class='toggle square' type="checkbox" name='toggle-3' checked='checked' />
        <input class='toggle square' type="checkbox" name='toggle-4' />
      </fieldset>
      
      <fieldset name="text-fields">
        <legend>Text Fields</legend>
        <!-- <label for="firstname">First Name:</label> -->
        <input type="text" name="firstname"  placeholder="First Name">
        <!--<label for="lastname">Last Name:</label>-->
        <input type="text" name="lastname" placeholder="Last Name">
        <!-- <label for="email">email:</label> -->
        <input type="email" name="email" placeholder="Email">
        <!-- <label for="pass">Password:</label> -->
        <input type="password" name="password" placeholder="Password">
        <!-- <label for="url">URL:</label> -->
        <input type="url" name="url" placeholder="URL">
        <!-- <label for="tel">Phone Number:</label> -->
        <input type="tel" name="tel" placeholder="Phone Number">
        <!-- <label for="number">Quntity:</label> -->
        <input type="number" name="number" placeholder="Quantity">
      </fieldset>
      
      
      <fieldset name="select">
        <legend>Dropdown</legend>
        <label for="cars"> 
          
        <select name='cars-1'>
          <optgroup>
          <option class="whips" value="" disabled selected>Pick Your Whip</option>
          </optgroup>
          <option value='nissan'>Nissan</option>
          <option value='honda'>Honda</option>
          <option value='chevy'>Chevy</option>
        </select>
        
      </fieldset>
    </form>

  </section>
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,700);
$base: #0888F0;
$gray: #dedede;
$white: #ffffff;

body{
  font-family: 'Open Sans', sans-serif;
  font-weight:300;
  color: $base;
  margin-bottom: 10em;
}

header {
  background: $base;
  color: $white;
  display: block;
  margin-bottom: 4em;
  padding: 2em 0;
}

h1{
  font-size: 2.5em;
  text-align: center;
  font-weight:700;
  span{
    margin-top: .5em;
    display: block;
    font-weight: 300;
    font-size: 60%;
    line-height: 1.6;
  }
}

form{
  width:70%;
  margin:0 auto;
}
fieldset {
  margin-bottom:12px;
  border: 1px dotted $base;
  padding:25px 20px;
  position:relative;
  margin-bottom: 3em;
  legend {
    font-size: 1.25em;
    font-weight: 400;
    line-height: 1;
    text-transform: uppercase;
    display: inline-block;
    position:absolute;
    left: .5em;
    top: -.5em;
    padding: 0 .5em;
    color: lighten($base, 15%);
    background-color: $white;
  }
}

//begin custom input styles
input[type='radio'],
input[type='checkbox']{
  display: none; //hide by default
  cursor: pointer; //make the cursor a pointer when over the items
  &:focus,
  &:active{
    outline: none;  //remove the annoying outline
  }
  & + label{
    cursor: pointer; 
    display: inline-block;
    position: relative;
    padding: 0 2em .25em;
    color: darken($base, 20%);
    &:before,
    &:after{
      content:'';
      font-family: helvetica;
      display: inline-block;
      width: 1.5em;
      height: 1.5em;      
      left: 0;
      bottom: 0;
      text-align: center;
      position: absolute;
    }
    &:before{
      background-color:$gray;
      @include transition(all .3s ease-in-out);
    }
    &:after{
      color: $white;
    }
  }
  &:checked + label:before{
    @include box-shadow(inset 0 0 0 .75em $base);    
  }
}

/*Radio Specific styles*/
input[type='radio']{
  & + label:before{
    @include border-radius(50%);
  }
  & + label:hover:after,
  &:checked + label:after{
    content:'';
    position:absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1em;
    width: 1em;
    margin: 0 0 0 .25em;
    background: $white;
    border-radius: 50%;
  }
  & + label:hover:after{
    color:darken($gray, 20%);  
  }
  &:checked + label:after,
  &:checked + label:hover:after{
    color: $white;
  }
}

/*Checkbox Specific styles*/
input[type='checkbox']{
  & + label:before{
    @include border-radius(3px); 
  }

  & + label:hover:after,
  &:checked + label:after{
    content:"\2713";
    line-height: 1.5;
    font-size: 1em;
  }
  & + label:hover:after{
    color:darken($gray, 20%);  
  }
  &:checked + label:after,
  &:checked + label:hover:after{
    color:#fff;
  }
}

/*Toggle Specific styles*/
input[type='checkbox']{
  &.toggle{
    display:inline-block;
    -webkit-appearance:none;
    -moz-appearance:none;
    appearance:none;
    width: 4.5em;
    height: 2.5em;
    background-color:$gray;
    position: relative;
    @include border-radius(2.25em);
    @inlcude box-shadow(none);
    @include transition(all .2s ease-in-out);
    &.square {
      @include border-radius(.25em);
      &:after {
        @include border-radius(.25em);
      }
    }
    &:hover:after{
      background-color: darken($gray, 20%);
    }
    &:after{      
      content:'';
      display:inline-block;
      position:absolute;
      width: 2em;
      height: 2em;
      background-color:darken($gray, 30%);
      top: .25em;
      left: .25em;
      @include border-radius(50%);
      @include transition(all .2s ease-in-out);
    }
  }
  &:checked.toggle{
    @include box-shadow(inset 0 0 0 1.5em $base);
    &:after{
      left: 2.25em;
      background-color: $white;
    }
  }
}

/*Text Input Specific styles*/
input[type='text'],
input[type='email'],
input[type='password'],
input[type='url'],
input[type='tel'],
input[type='number'] {
  border: none;
  outline: none;
  @include border-radius(3px);
  padding: .5em;
  background: $gray;
  margin: 0 1% 1em 0;
  height: 1.625em;
  width: 47%;
  color: $base;
  font-size: 1em;
  font-weight: 500;
  @include transition(all .4s ease);
  @include input-placeholder {
    color: lighten($base, 15%);
    @include transition(all .4s ease);
  }  
  &:focus, &:hover {
    @include box-shadow(0 0 4px 1px (rgba($base, 0.5)));
    border: none;
    @include input-placeholder {
      color: darken($gray, 10%);
    }
  }
}

input[type='email'] {
  width: 96.5%;
}


select {
  cursor: pointer;
  border: none;  
  outline: none;
  padding: .25em .5em;
  background: $gray;
  margin: 0 5% 0 0;
  height: 2.5em;
  width: 30%;
  color: lighten($base, 15%);
  font-size: 1.125em;
  @include border-radius(3px);
  &:focus, &:hover {
    outline: none;
    color: $white;
    background: darken($gray, 10);
    @include border-radius(3px);
    option {
      color: $base;
      &:disabled {
        display: none;
      }
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console