<div class="tiles">
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
  <div class="tile">
    <div class="card front"></div>
    <div class="card back"></div>
  </div>
</div>
<a href="javascript:void(0);" class="reload">
  Reload
</a>
// Variables.
$tile-bg: #cfcfdf;

// Styles.
.tiles {
  left: 50%;
  perspective: 400px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  width: 330px;
}

.tile {
  animation: .6s cubic-bezier(.25, .25, .25, 1.15) both fade-in;
  background: $tile-bg;
  border-radius: 4px;
  float: left;
  height: 75px;
  margin: 5px;
  width: 100px;
  
  .card {
    backface-visibility: hidden;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    // transform-origin: right center;
    width: 100%;
    // z-index: 1;
    
    &.front {
    }
    
    &.back {
      transform: rotateY( 180deg );
    }
  }
}

// Loop from 1-12.
@for $i from 1 through 12 {
  .tile {
    &:nth-child(#{$i}) {
      
      // Delay the animation. Delay increases as items loop.
      animation-delay: $i * (.04s);
    }
  }
}

@keyframes fade-in {
  0% {
    opacity: 0;
    transform: rotateY(180deg);
  }
  
  100% {
    opacity: 1;
    transform: rotateY(0deg);
  }
}

.reload {
  background: #e2751c;
  background: linear-gradient(45deg, rgba(#e21c1c,1) 0%, rgba(#e2751c,1) 100%);
  border-radius: 50px;
  bottom: 20px;
  box-shadow: 0 5px 20px rgba(#000, .2);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  left: 50%;
  letter-spacing: .075em;
  padding: 10px 15px;
  position: absolute;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateX(-50%);
}

html {
  height: 100%;
  width: 100%;
}

body {
  font-family: helvetica, arial, sans-serif;
  height: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  text-align: center;
  width: 100%;
}
var reload = document.querySelector('.reload');
var tiles = document.querySelector('.tiles');
var newTiles = getNewTiles();


reload.addEventListener('click', function() {
  
  // Remove existing tiles.
  tiles.innerHTML = '';
  
  // Add new tiles.
  tiles.innerHTML = newTiles;
});


function getNewTiles() {
  
  var newTiles = '';
  
  var newTile = '';
  newTile += '<div class="tile">';
    newTile += '<div class="card front"></div>';
    newTile += '<div class="card back"></div>';
  newTile += '</div>';
  
  for(var i = 0; i < 12; i++) {
    newTiles += newTile;
  }
  
  return newTiles;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.