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.

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

              
                <ul class="diamonds">
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/1" alt="">
        </div>
        <div class="back">
          <span>item 01</span>
        </div>
      </a>
    </li>
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/2" alt="">
        </div>
        <div class="back">
          <span>item 02</span>
        </div>
      </a>
    </li><li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/3" alt="">
        </div>
        <div class="back">
          <span>item 03</span>
        </div>
      </a>
    </li>
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/4" alt="">
        </div>
        <div class="back">
          <span>item 04</span>
        </div>
      </a>
    </li>
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/5" alt="">
        </div>
        <div class="back">
          <span>item 05</span>
        </div>
      </a>
    </li>
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/6" alt="">
        </div>
        <div class="back">
          <span>item 06</span>
        </div>
      </a>
    </li>
    <li>
      <a href="#" class="flipper">
        <div class="front">
          <img src="http://lorempixel.com/250/250/food/7" alt="">
        </div>
        <div class="back">
          <span>item 07</span>
        </div>
      </a>
    </li>
</ul>
              
            
!

CSS

              
                *, *:after, *:before {
  box-sizing: border-box; 
}
html{
  min-height:100%;
  background: #F5F5F5;
  background: linear-gradient(top, #F5F5F5 0%,#A7A7A7 100%);
}

ul, li{
  margin:0;
  padding:0;
  list-style:none;
}

.diamonds{
  font-size:1em;
  width: 46.875em;
  margin: 0 auto;
  padding: 4.500em 0 0 ;
}

.diamonds li {
	perspective: 1000;
  width: 11.125em;
  height: 11.125em;
  display: block;
  float:left;
  margin-left: 4.500em;
}

/*:nth-child recipes FTW!*/
.diamonds li:nth-child(2) ~ li{margin-top: -3.313em;}

.diamonds li:nth-child(5n+1){
  margin-left: 10.063em;
}

.diamonds li:nth-child(6n-9){
  margin-left: 2.250em;
}

/*the flipping thingy*/
.flipper {
  display:block;
  width:100%;
  height:100%;
  transform-origin: center center;
  transition: 0.5s;
  transform-style: preserve-3d;
  position: relative;
  color:#3a66b3;
}

/*animate on hover*/
.flipper:hover {
  transform:
    rotateX(0deg)
    rotateY(180deg)
    rotateZ(0deg);
}

.front, .back {
  width: 100%;
  height: 100%;
  overflow:hidden;
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
}

.front {
  z-index: 2;
  transform:
    rotateX(0deg)
    rotateY(0deg)
    rotateZ(45deg);
  border: 1px solid #DBDBDB;
}

.back {
  background: #DBDBDB;
  transform:
    rotateX(0deg)
    rotateY(180deg)
    rotateZ(45deg);
}

.front img{
  width:140.5%;
  height:auto;
  transform:
    translateX(-14.5%)
    translateY(-14.5%)
    translateZ(0)
    rotateX(0deg)
    rotateY(0deg)
    rotateZ(-45deg);
}

.back span{
  display:block;
  width:100%;
  height:100%;
  line-height:11.125em;
  text-align:center;
    transform:
    rotateX(0deg)
    rotateY(0deg)
    rotateZ(-45deg);
}

              
            
!

JS

              
                /*
inspiration from:

http://pepsized.com/diagonal-thumbnails-gallery/

and David Walsh's CSS Flip animation:

https://codepen.io/darkwing/pen/bCali

              
            
!
999px

Console