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

              
                #cube
  .face-bottom
    .content
    .face-back
    .face-left
    .face-right
    .face-front 
      .face-top
              
            
!

CSS

              
                #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
  

              
            
!

JS

              
                $("div[class^='face']").click(function(e){
  $(this).toggleClass("is-folded")
  e.stopPropagation();
})
              
            
!
999px

Console