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

            
              #btn
  #checkbox
    .tick
      #rect1
      #rect2
  
            
          
!

CSS

            
              custom_time_func = cubic-bezier(.38,.24,.28,1.17)

body
  display flex
  width 100vw
  height 100vh
  justify-content center
  align-items center
  background #F2F2F2
  #btn
    background white
    width 180px
    height 96px
    border-radius 24px
    box-shadow 0px 64px 96px rgba(0,0,0,0.05)
    &:hover
      cursor pointer
    #checkbox
      width 72px
      height 72px
      margin-left 96px
      margin-top 12px
      background #7DD451
      border-radius 16px
      box-shadow 0px 4px 4px rgba(125,212,81,0.2)
      .tick
        background transparent
        transform rotate(45deg)
        position absolute
        margin-left 44px
        margin-top 11px
        #rect1
          background white
          width 8px
          height 40px
          margin-left 12px
          position absolute
        #rect2
          background white
          width 20px
          height 8px
          margin-top 32px
          position absolute
          
.h_btn
  transform scale(0.9)
.h_cb
  margin-left 12px !important
  background #E5E5E5 !important
  box-shadow 0px 4px 4px rgba(0,0,0,0.05) !important
.h_rects
  background #E5E5E5 !important
  
  
 // Sorry for that...
 *
   transition all 0.3s custom_time_func
            
          
!

JS

            
              // Get elements
let btn = document.getElementById("btn")
let checkbox = document.getElementById("checkbox")
let rect1 = document.getElementById("rect1")
let rect2 = document.getElementById("rect2")

// Set events
btn.addEventListener("mousedown", animeDown)
btn.addEventListener("mouseup", animeUp)

// CSS toggle functions
function animeDown() {
  btn.classList.toggle("h_btn")
}

function animeUp() {
  btn.classList.toggle("h_btn")
  checkbox.classList.toggle("h_cb")
  rect1.classList.toggle("h_rects")
  rect2.classList.toggle("h_rects")
}
            
          
!
999px

Console