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 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

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.

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

              
                .container
  .front disable
  .back enable
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Lato)

$bgColor = #2196F3
$containerColor = #fff
$containerWidth = 200px
$containerHeight = 60px
$containerBorderRadius = 4px
$containerShadow = 0px 2px 4px rgba(0,0,0,.1)
$textColor = #333

*
  transition all .5s ease
  box-sizing border-box

body
  perspective 300px
  font-family 'Lato', Arial, sans-serif
  background $bgColor
  display flex
  justify-content center
  align-items center
  width 100vw
  height 100vh
  text-transform uppercase
  color $textColor
  font-size 18px
  letter-spacing 2px
  overflow hidden
  .container
    background transparent
    width $containerWidth
    height $containerHeight
    box-shadow $containerShadow
    line-height $containerHeight
    text-align center
    transform rotateX(0deg)
    transform-style preserve-3d
    &:hover
      cursor pointer
    .front
      width $containerWidth
      height $containerHeight
      background white
      position absolute
      backface-visibility hidden
      border-radius $containerBorderRadius
      z-index 2
      transform rotateX(0deg)
    .back
      width $containerWidth
      height $containerHeight
      position absolute
      background white
      border-radius $containerBorderRadius
      backface-visibility hidden
      transform rotateX(180deg)

              
            
!

JS

              
                $(document).ready ->

  rotateX = 0
  count = 0

  $(".container").on "mousedown", ->
    rotateX += 180
    $("body").css("transform": "scale(1.2)")
    if count%2 is 0
      $(".container").css("box-shadow": "0px 32px 56px rgba(0,0,0,.1)")
    else
      $(".container").css("box-shadow": "0px -32px 56px rgba(0,0,0,.1)")


  $(".container").on "mouseup", ->
    $(@).css("transform": "rotateX(#{rotateX}deg)")
    $("body").css("transform": "scale(1)")

    if count%2 is 0
      $("body").css("background": "#ccc")
      $(".container").css("box-shadow": "0px -2px 4px rgba(0,0,0,.1)")
    else
      $("body").css("background": "#2196F3")
      $(".container").css("box-shadow": "0px 2px 4px rgba(0,0,0,.1)")

    count++

              
            
!
999px

Console