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

            
              
<div class="container">
  
  <!--
  
  the basic HTML to get a cube
  using the mixin is:
  <span class="cube"><b></b><s></s></span>
  
  the other classes u see below are 
  for extra pizzaz.

  -->
  
  
<span class="cube one zoom back"><b></b><s></s></span>
<span class="cube two zoom back"><b></b><s></s></span>
<span class="cube three zoom back"><b></b><s></s></span>
<span class="cube four zoom back"><b></b><s></s></span>
  
<span class="cube five zoom front"><b></b><s></s></span>
<span class="cube six zoom front"><b></b><s></s></span>
<span class="cube seven zoom front"><b></b><s></s></span>
  
  
</div>
            
          
!

CSS

            
              @size: 100px;
@green: rgb(22, 160, 133);
@red: rgb(192, 57, 43);
@purple: rgb(142, 68, 173);
@blue: rgb(41, 128, 185);
@black: rgb(44, 62, 80);


// mixin for making cubes from html
.makecube( @color: grey , @csize: @size ) { 
  
  position: absolute; width: @csize; height: @csize;
  transform-style: preserve-3d;
  transform-origin: @csize/2 @csize/2 -@csize/2; 
  transform: rotate3d(0,0,0,0deg);

  b, s, 
  b:before, s:before,
  b:after, s:after {
    display: block; position: absolute; content: " ";
    width: @csize; height: @csize; background: @color;
    box-shadow: inset 0 0 @csize*0.2 darken( @color ,2%);
    transform-style: preserve-3d; z-index: 2;
    transform-origin: center center;
  }

  s { transform: translateZ(-@csize) rotateZ(90deg) rotateY(180deg); }

  b:after,
  s:after{ transform: translateX(@csize*0.5) translateZ(-@csize*0.5) rotateY(90deg); }
  b:before,
  s:before { transform: translateX(-@csize*0.5) translateZ(-@csize*0.5) rotateY(90deg); }

  s:after { background: lighten( @color , 4% ); }
  s:before { background: darken( @color , 5% ); }
  b:after,
  b:before { background: darken( @color , 5% ); }

}





// other css for extra stuff and for positioning
// or perspective setup.


body,html { 
  padding:0; margin: 0;
  background: linear-gradient(to bottom, rgba(241,241,241,1)40%,rgba(225,225,225,1) 41%,rgba(250,250,250,1) 100%);
  
  background-size: 100% 430px;
  background-repeat: repeat-x;
  
}

.container { 
  font-size: @size; 
  height: 300px; width: 100%; min-width: 950px;
  position: relative;
   
  perspective: 2000px;
  transform-origin: center -200px;
  transform-style: preserve-3d;
  
}

.cube { 
  
  margin-left: -0.5em;
  transition: all 2s cubic-bezier(0.275, 1.530, 0.600, 0.965);
  opacity: 1;
  
}






.cube.zoom { opacity: 0; }
.cube.zoom.front { transform: translateZ(1000px); }
.cube.zoom.back { transform: translateZ(-1000px); }

.cube.hover {
   animation: hover 9s ease infinite; 
}

.cube.one { 
  .makecube( @green );
  left: 10%; top: 1em;
}
.cube.two { 
  .makecube( @blue );
  left: 38%; top: 1em;
}
.cube.three { 
  .makecube( @red );
  left: 62%; top: 1em;
}
.cube.four { 
  .makecube( @purple );
  left: 90%; top: 1em; 
}


.cube.five ,
.cube.six ,
.cube.seven { .makecube( @black , 80px ); }

.cube.five { 
  left: 25%; top: 1em;
}
.cube.six { 
  left: 50%; top: 1em;
}
.cube.seven { 
  left: 75%; top: 1em;
}

.cube.five.hover,
.cube.six.hover,
.cube.seven.hover {
animation: hover2 3s ease infinite;
}








@keyframes hover {
   
  20% { transform: rotate3d(1,0,0,180deg); }
  40% { transform: rotate3d(1,1,0,180deg); }    
  60% { transform: rotate3d(0,1,1,180deg); }    
  80% { transform: rotate3d(0,1,0,180deg); }  
  
}

@keyframes hover2 {
   
  50% { transform: translateZ(0px) rotate3d(1,1,0,-90deg); } 
  
}
            
          
!

JS

            
              
// just some fluff for the intro sexyness
$(function() {

  $('.cube').each( function(k,el) {
    
    setTimeout( function() {
      $(el).removeClass('zoom');
    }, k*200 );
    
    setTimeout( function() {
      $(el).addClass('hover');
    }, 2111 + k*417 );
    
  });


});
            
          
!
999px

Console