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

              
                input(type='checkbox')#codepen.checkbox
label(for='codepen')
              
            
!

CSS

              
                $red: #fd1a15
$green: #007177
$btnWidth: 116px
$switchWidth: 300px
$switchHeight: 130px
$padding: 7px

*
  box-sizing: border-box

html, body
  height: 100%

body
  display: flex
  align-items: center
  justify-content: center

.checkbox
  display: none

.checkbox + label
  display: inline-block
  position: relative
  width: $switchWidth
  height: $switchHeight
  background: linear-gradient(to right, $red 0, #fc8b34 45%, #7fd03e 55%, $green 100%) 0 0
  background-size: (($switchWidth * 2) + 50) 100%
  border-radius: 70px
  padding: $padding
  cursor: pointer
  transition: all 500ms ease
  box-shadow: 0 0px 10px rgba(0, 0, 0, 0.2) inset
  
  &:before
    content: 'Off'
    width: $btnWidth
    height: $btnWidth
    position: absolute
    left: $padding
    top: $padding
    border-radius: 100%
    background: #fff
    text-align: center
    line-height: ($switchHeight - ($padding * 2))
    font-family: 'Cabin', sans-serif
    font-size: 35px
    font-weight: bold
    color: $red
    letter-spacing: 3px
    text-transform: uppercase
    transition: left 500ms ease, color 500ms ease, transform 150ms ease
  
  &:active
    &:before
      transform: scale(0.95)

.checkbox:checked + label
  background-position-x: -($switchWidth + 50)
  &:before
    content: 'On'
    color: $green
    left: ($switchWidth - $btnWidth - $padding)
              
            
!

JS

              
                // Hi there ! ^_^
              
            
!
999px

Console