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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              #wrapper
  main#main
    form(action="#")
      h3 Clean markup
      p
        label(for="file") Attachment
        span.file-input
          input.file(type='file', name='file', size='40', id="file")

      h3 WordPress contact form 7 plugin
      label Attachment
        br
        span.wpcf7-form-control-wrap.file-input
          input.wpcf7-form-control.wpcf7-file(type='file', name='file-input', size='40')

            
          
!

CSS

            
              %hidden-input
  position: absolute // hide and stretch
  top: 0
  left: 0
  width: 100%
  height: 100%
  opacity: 0
  z-index: 10
  cursor: pointer

%file-input
  @extend %input // add standard input styles
  display: block
  position: relative
  overflow: hidden
  cursor: pointer
  &:before
    content: '\00a0' // by default it\'s empty, avoid 0 height
  &:after
    content: 'Choose file' // or data attribute
    @extend %button  // add button
    position: absolute
    top: 0
    right: 0
    bottom: 0 // to stretch it, just in case

[type='file']
  @extend %hidden-input  
  
.file-input
  @extend %file-input
  
label[for], span.floating-label
  @extend %floating-label


$text: black
$bg: white

$label: $text

%block
  padding: .75em 1.5em
  appearance: none
  outline: none
  line-height: normal
  border-radius: 0
  border: none
  
%button-style
  @extend %block
  
  font: inherit
  line-height: normal
  cursor: pointer

  text-transform: uppercase
  text-align: center
  letter-spacing: #{(2/14)}em
  border-width: 2px 
  border-style: solid

  transition: all .3s cubic-bezier(0.5, 0.000, 0.000, 1.000)

  // &:active:not(select):not(input):not([class*=Select])
  //   position: relative
  //   top: 1px
  //   left: 1px

%button
  @extend %button-style

  background-color: $text
  border-color: $text
  color: white

  &:hover, &:focus, &:active
    color: $text
    background: white
    border-color: $text
    text-shadow: none

%form-block
  padding: calc(.75em + 2px) 1.25em
  appearance: none
  outline: none
  line-height: normal
  border-radius: 0
  border: none

%input
  @extend %form-block

  font: inherit
  line-height: normal
  width: 100%
  box-sizing: border-box
  display: block

  background: rgba(black,.05)
  outline: none
  border: none
  box-shadow: inset 0 1px 1px 0px rgba(black,.1)
  transition: all .15s ease

  color: inherit

  &:placeholder
    color: inherit

  
  &.error, .error &
    background-color: mix(red,white,10%)
  
  .form:not(.has-floated-label) &
    &:active, &:focus
      border-color: transparent transparent $text transparent

  &:focus
    box-shadow: inset 0 2px 1px 0px rgba(black,.2)
    background: rgba(black,.1)

%label-style
  font-size: .75rem
  font-weight: 600
  text-transform: uppercase
  color: inherit
  letter-spacing: .1em

%floated
  @extend %form-block
  
  position: absolute
  z-index: 10
  pointer-events: none
  
%floating-label
  @extend %floated
  
  top: 0
  left: 0
  color: inheir
  transition: color .3s
  
  &.active, .active &
    @extend %label-style
    padding-left: 0
    top: auto
    bottom: 100%
    line-height: 1

  .focus &
    color: inherit
    pointer-events: auto

form
  max-width: 60rem
  margin: 2rem

form
  > label, > p
    margin: 1.5em 0
    position: relative
    display: block
    br
      display: none
  
p + h3
  margin-top: 2em
  
h3
  margin-bottom: 1.5em

body
  .background-gradient &
    background: linear-gradient(to right bottom, #f3904f, #3b4371)
    color: white
    text-shadow: 0 1px 2px rgba(black,.5)
  
svg
  path
    fill: black
            
          
!

JS

            
              class customFileInput

  constructor: ( fileInputs ) ->
      
    for fileInput in fileInputs
      
      fileInput.form.classList.add 'has-custom-file-inputs'
      fileInput.classList.add 'custom-file-input'

      fileInput.addEventListener 'change', ->
        
        files = ( file.name for file in @files )
          
        if @parentNode.lastChild.nodeValue
          @parentNode.lastChild.nodeValue = files.join(', ') 
        else
          @parentNode.appendChild document.createTextNode(files.join(', '))
      
new customFileInput document.querySelectorAll('[type=file]')


# additional

class floatingLabel
  
  constructor: ( labels, classes={} ) ->
    
    classes.focus ||= "focus"
    classes.active ||= "active"
    classes.error ||= "error"

    for label in labels

      return unless input = label.control

      if label.querySelector('input, textarea')
        span = document.createElement('span')
        span.appendChild document.createTextNode(label.firstChild.nodeValue)
        label.replaceChild span, label.firstChild
        label = label.firstChild
        
      label.classList.add 'floating-label'
      input.form.classList.add 'has-floating-labels'
      
      while (input.parent ||= input).tagName not in ['DIV','P','LI']
        input.parent = input.parent.parentNode
                  
      for event in ['keyup','input', 'change']
        input.addEventListener event, ->
          @parent.classList.remove classes.error
          @parent.classList.toggle classes.active, !!@value
      input.addEventListener 'focus', ->
        @parent.classList.add classes.focus
      input.addEventListener 'blur', ->
        @parent.classList.remove classes.focus
      input.parent.classList.toggle classes.active, !!input.value
    
new floatingLabel document.querySelectorAll('form label')
            
          
!
999px

Console