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

              
                <div class="mario">
  <!-- row1 -->
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row1 -->
  <!-- row2 -->
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row2 -->
  <!-- row3 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row3 -->
  <!-- row4 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row4 -->
  <!-- row5 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row5 -->
  <!-- row6 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row6 -->
  <!-- row7 -->
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row7 -->
  <!-- row8 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row8 -->
  <!-- row9 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row9 -->
  <!-- row10 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row10 -->
  <!-- row11 -->
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row11 -->
  <!-- row12 -->
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row12 -->
  <!-- row13 -->
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube co"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row13 -->
  <!-- row14 -->
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cr"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row14 -->
  <!-- row15 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row15 -->
  <!-- row16 -->
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <div class="cube cb"><div>&nbsp;</div><div>&nbsp;</div></div>
  <!-- /row16 -->
</div>
              
            
!

CSS

              
                @import "compass/css3";

$size: 20px;
body {
  background: #000;
  @include perspective($size*12);
  @include transform-style(preserve-3d);
}
.mario {
  display: block;
  position: relative;
  width: $size * 12;
  height: $size * 16;
  margin: $size * 5 auto;
  @include transform-style(preserve-3d);
  @include animation(rotate 30s infinite linear);
}
.cube {
  display: block;
  position: absolute;
  width: $size;
  height: $size;
  line-height: $size;
  text-align: center;
  @include transform-style(preserve-3d);
  div, div:before, div:after {
    position: absolute;
    width: $size;
    height: $size;
    background-color: rgba(#fff,.5);
    @include transform-style(preserve-3d);
    @include box-sizing(border-box);
    @include background-image(linear-gradient(left top, rgba(#000,0), rgba(#000,.1)));
    &:before, &:after {
      display: block;
      content: "";
    }
  }
}
.cube div:nth-of-type(1) {
  //Front
  @include transform(translateZ($size/2));
}
.cube div:nth-of-type(1):before {
  @include transform(rotateX(90deg) translateZ($size/2) translateY(-$size/2));
}
.cube div:nth-of-type(1):after {
  @include transform(rotateX(-90deg) translateZ(-$size/2) translateY($size/2));
}
.cube div:nth-of-type(2) {
  //Back
  @include transform(translateZ(-$size/2) rotateY(180deg));
}
.cube div:nth-of-type(2):before {
  @include transform(rotateY(-90deg) translateZ($size/2) translateX(-$size/2));
}
.cube div:nth-of-type(2):after {
  @include transform(rotateY(90deg) translateZ($size/2) translateX($size/2) translateY(-$size));
}

//row1
@for $i from 1 through 5 {
  .cube:nth-of-type(#{$i}) {
    top: 0;
    left: #{($size * 2) + ($size * $i)};  
  }
}
//row2
@for $i from 6 through 14 {
  .cube:nth-of-type(#{$i}) {
    top: $size;
    left: #{($size) + ($size * ($i - 5))};  
  }
}
//row3
@for $i from 15 through 21 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 2;
    left: #{($size) + ($size * ($i - 14))};  
  }
}
//row4
@for $i from 22 through 31 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 3;
    left: #{($size * 1) + ($size * ($i - 22))};  
  }
}
//row5
@for $i from 32 through 42 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 4;
    left: #{($size * 1) + ($size * ($i - 32))};  
  }
}
//row6
@for $i from 43 through 52 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 5;
    left: #{($size * 1) + ($size * ($i - 43))};  
  }
}
//row7
@for $i from 53 through 59 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 6;
    left: #{($size * 3) + ($size * ($i - 53))};  
  }
}
//row8
@for $i from 60 through 65 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 7;
    left: #{($size * 2) + ($size * ($i - 60))};  
  }
}
//row9
@for $i from 66 through 75 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 8;
    left: #{($size * 1) + ($size * ($i - 66))};  
  }
}
//row10
@for $i from 76 through 87 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 9;
    left: #{($size * ($i - 76))};  
  }
}
//row11
@for $i from 88 through 99 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 10;
    left: #{($size * ($i - 88))};  
  }
}
//row12
@for $i from 100 through 111 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 11;
    left: #{($size * ($i - 100))};  
  }
}
//row13
@for $i from 112 through 123 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 12;
    left: #{($size * ($i - 112))};  
  }
}
//row14
@for $i from 124 through 126 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 13;
    left: #{(($size * 2) + ($size * ($i - 124)))};  
  }
}
@for $i from 127 through 129 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 13;
    left: #{(($size * 7) + ($size * ($i - 127)))};  
  }
}
//row15
@for $i from 130 through 132 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 14;
    left: #{(($size * 1) + ($size * ($i - 130)))};  
  }
}
@for $i from 133 through 135 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 14;
    left: #{(($size * 5) + ($size * ($i - 130)))};  
  }
}
//row16
@for $i from 136 through 139 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 15;
    left: #{($size * ($i - 136))};  
  }
}
@for $i from 140 through 143 {
  .cube:nth-of-type(#{$i}) {
    top: $size * 15;
    left: #{(($size * 8) + ($size * ($i - 140)))};  
  }
}


@-webkit-keyframes rotate {
  0% {@include transform(rotateY(0deg))}
  100% {@include transform(rotateY(360deg))}
}
@keyframes rotate {
  0% {@include transform(rotateY(0deg))}
  100% {@include transform(rotateY(360deg))}
}

//color
.cr {
  background-color: rgba(#d71900,1);
  div, div:before, div:after {
    background-color: rgba(#d71900,1);
  }
}
.cb {
  background-color: rgba(#7f5f00,1);
  div, div:before, div:after {
    background-color: rgba(#7f5f00,1);
  }
}
.co {
  background-color: rgba(#ff9b00,1);
  div, div:before, div:after {
    background-color: rgba(#ff9b00,1);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console