cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

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

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console