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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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">
  <div class="control-group">
    <h1>Checkboxes</h1>
    <label class="control control--checkbox">First checkbox
      <input type="checkbox" checked="checked"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--checkbox">Second checkbox
      <input type="checkbox"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--checkbox">Disabled
      <input type="checkbox" disabled="disabled"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--checkbox">Disabled & checked
      <input type="checkbox" disabled="disabled" checked="checked"/>
      <div class="control__indicator"></div>
    </label>
  </div>
  <div class="control-group">
    <h1>Radio buttons</h1>
    <label class="control control--radio">First radio
      <input type="radio" name="radio" checked="checked"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--radio">Second radio
      <input type="radio" name="radio"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--radio">Disabled
      <input type="radio" name="radio2" disabled="disabled"/>
      <div class="control__indicator"></div>
    </label>
    <label class="control control--radio">Disabled & checked
      <input type="radio" name="radio2" disabled="disabled" checked="checked"/>
      <div class="control__indicator"></div>
    </label>
  </div>
  <div class="control-group">
    <h1>Select boxes</h1>
    <div class="select">
      <select>
        <option>First select</option>
        <option>Option</option>
        <option>Option</option>
      </select>
      <div class="select__arrow"></div>
    </div>
    <div class="select">
      <select>
        <option>Second select</option>
        <option>Option</option>
        <option>Option</option>
      </select>
      <div class="select__arrow"></div>
    </div>
    <div class="select">
      <select disabled="disabled">
        <option>Disabled</option>
        <option>Option</option>
        <option>Option</option>
      </select>
      <div class="select__arrow"></div>
    </div>
  </div>
</div>
            
          
!
            
              $color--white = #FFFFFF
$color--black = #000000
$color--light-grey = #E6E6E6
$color--grey = #CCCCCC
$color--dark-grey = #7B7B7B
$color--primary = #2AA1C0
$color--secondary = #0E647D

html, body
  height 100%

body
  background $color--light-grey
  font-family 'Source Sans Pro', sans-serif

.container
  width 100%
  height 100%
  display flex
  flex-wrap wrap
  justify-content center
  align-items center

h1
  font-family 'Alegreya Sans', sans-serif
  font-weight 300
  margin-top 0

// Box to contain form controls
.control-group
  display inline-block
  vertical-align top
  background $color--white
  text-align left
  box-shadow 0 1px 2px rgba(0, 0, 0, 0.1)
  padding 30px
  width 200px
  height 210px
  margin 10px

// Basic control styles
.control
  display block
  position relative
  padding-left 30px
  margin-bottom 15px
  cursor pointer
  font-size 18px
  
  // Hide default browser input
  input
    position absolute
    z-index -1
    opacity 0
    

// Custom control
.control__indicator
  position absolute
  top 2px
  left 0
  height 20px
  width 20px
  background $color--light-grey
  
  .control--radio &
    border-radius 50% // Makes radio buttons circlular
  
  // Hover and focus
  .control:hover input ~ &,
  .control input:focus ~ &
    background $color--grey
  
  // Checked
  .control input:checked ~ &
    background $color--primary

  // Hover when checked
  .control:hover input:not([disabled]):checked ~ &,
  .control input:checked:focus ~ &
    background $color--secondary
  
  // Hide default browser input
  .control input:disabled ~ &
    background $color--light-grey
    opacity 0.6
    pointer-events none

  &:after
    content ''
    position absolute
    display none // Hide check

    .control input:checked ~ &
      display block // Show check
 
    // Checkbox tick
    .control--checkbox &
      left 8px
      top 4px
      width 3px
      height 8px
      border solid $color--white
      border-width 0 2px 2px 0
      transform rotate(45deg)
    
    // Disabled tick colour
    .control--checkbox input:disabled ~ &
      border-color $color--dark-grey

    // Radio button inner circle
    .control--radio &
      left 7px
      top 7px
      height 6px
      width 6px
      border-radius 50%
      background $color--white

    // Disabled circle colour
    .control--radio input:disabled ~ &
      background $color--dark-grey
      
.select
  position relative
  display inline-block
  margin-bottom 15px
  width 100%

  select
    display inline-block
    width 100%
    cursor pointer
    padding 10px 15px
    outline 0
    border 0
    border-radius 0
    background $color--light-grey
    color $color--dark-grey
    appearance none
    -webkit-appearance none
    -moz-appearance none
    
    &::-ms-expand
      display none
    
    &:hover,
    &:focus
      color $color--black
      background $color--grey
  
    &:disabled
      opacity 0.5
      pointer-events none
      
.select__arrow
  position absolute
  top 16px
  right 15px
  width 0
  height 0
  pointer-events none
  border-style solid
  border-width 8px 5px 0 5px
  border-color $color--dark-grey transparent transparent transparent
  
  .select select:hover ~ &
  .select select:focus ~ &
    border-top-color $color--black
  
  .select select:disabled ~ &
    border-top-color $color--grey
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console