<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
  
  // Hide default browser input
  input
    position absolute
    z-index -1
    opacity 0
    

// Custom control
.control__indicator
  position absolute
  top 0px
  left 0
  height 16px
  width 16px
  background #fff
  border 1px solid #ccc
  
  .control--checkbox &
    border-radius 3px
  
  .control--radio &
    border-radius 50% // Makes radio buttons circlular
  
  // Hover and focus
  .control:hover input:not([disabled]) ~ &,
  .control input:focus ~ &
    border-color: #666
  
  // Checked
  .control input:checked ~ &
    background #fff

  // Hover when checked
  /*
  .control:hover input:not([disabled]):checked ~ &,
  .control input:checked:focus ~ &
    border-color: #666
    */
  
  // 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 5px
      top 0px
      width 5px
      height 12px
      border solid #34bb92
      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 5px
      top 5px
      height 6px
      width 6px
      border-radius 50%
      background #34bb92

    // 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
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.