Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              #cube
  .face-bottom
    .content
    .face-back
    .face-left
    .face-right
    .face-front 
      .face-top
            
          
!
            
              #cube
  position: relative
  top: 100px
  left: 50%
  transform-style: preserve-3d
  transition: transform 2s 
  transform: rotateX(60deg) rotateZ(20deg)
  transform-origin: center top
  width: 100px
  height: 100px
div[class^='face']
  width: 100px
  height: 100px
  background: rgba(220,220,220,0.8)
  border: solid 1px #777
  position: absolute
  box-sizing: border-box
  transform-style: preserve-3d
  transition: transform 2s 
  
  
.face-back
  top: -100%
  left: -1px
  transform-origin: center bottom
  &.is-folded
    transform: rotateX(-90deg)
.face-front, .face-top
  top: 100%
  left: -1px
  transform-origin: center top
  &.is-folded
    transform: rotateX(90deg)
.face-left
  top: -1px
  left: 100%
  transform-origin: left center
  &.is-folded
    transform: rotateY(-90deg)
.face-right
  top: -1px
  right: 100%
  transform-origin: right center
  &.is-folded
    transform: rotateY(90deg)
    
@keyframes rotation
  from
    transform: translateZ(50px) rotateX(90deg) rotateY(0deg)
  to
    transform: translateZ(50px) rotateX(90deg) rotateY(360deg)
    
.content
  animation: rotation 5s linear 2s infinite
  width: 30px
  height: 30px
  background: blue
  position: absolute
  top: 35px
  left: 35px
  transform-style: preserve-3d
  transform: translateZ(50px) rotateX(90deg)
  &::before, &::after
    content: ""
    display: block
    width: 100%
    height: 100%
    position: absolute
    top: 0
    left: 0
    transform-style: preserve-3d
  &::before
    transform-origin: left center
    transform: rotateY(60deg)
    background: red
  &::after
    transform-origin: right center
    transform: rotateY(-60deg)
    background: green
  

            
          
!
            
              $("div[class^='face']").click(function(e){
  $(this).toggleClass("is-folded")
  e.stopPropagation();
})
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console