.tiles
  - (1..15).each do |i|
    .col
      - (1..4).each do |i|
        <a href="#"></a>
      .box
View Compiled
@charset "UTF-8";
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");

html, body {
  margin: 0;
  padding: 0;
  background: #f1deb9;
}

.tiles {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  width: 750px;
  height: 450px;
  perspective: 1000px;
}

.col {
  position: relative;
  float: left;
  margin: 6px;
  width: calc(150px - 12px);
  height: calc(150px - 12px);
  a {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    &:nth-child(1) {
      -webkit-clip-path: polygon(0 0, 100% 0, 50% 50%);
      clip-path: polygon(0 0, 100% 0, 50% 50%);
    }
    &:nth-child(2) {
      -webkit-clip-path: polygon(100% 0, 100% 100%, 50% 50%);
      clip-path: polygon(100% 0, 100% 100%, 50% 50%);
    }
    &:nth-child(3) {
      -webkit-clip-path: polygon(0 100%, 50% 50%, 100% 100%);
      clip-path: polygon(0 100%, 50% 50%, 100% 100%);
    }
    &:nth-child(4) {
      -webkit-clip-path: polygon(0 0, 50% 50%, 0 100%);
      clip-path: polygon(0 0, 50% 50%, 0 100%);
    }
    &:hover {
      z-index: 3;
      -webkit-clip-path: none;
      clip-path: none;
    }
    &:nth-child(1):hover ~ .box {
      transform: rotateX(180deg);
    }
    &:nth-child(2):hover ~ .box {
      transform: rotateY(180deg);
    }
    &:nth-child(3):hover ~ .box {
      transform: rotateX(-180deg);
    }
    &:nth-child(4):hover ~ .box {
      transform: rotateY(-180deg);
    }
    &:nth-child(1):hover ~ .box:after, &:nth-child(3):hover ~ .box:after {
      transform: rotateX(-180deg);
    }
    &:nth-child(2):hover ~ .box:after, &:nth-child(4):hover ~ .box:after {
      transform: rotateY(-180deg);
    }
  }
  .box {
    position: absolute;
    width: 100%;
    height: 100%;
    font-family: "Open Sans", sans-serif;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
      0 3px 1px -2px rgba(0, 0, 0, 0.2),
      0 1px 5px 0 rgba(0, 0, 0, 0.12);
    transform-style: preserve-3d;
    transition: transform .3s ease-in-out;
    &:before {
      content: "";
      position: absolute;
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #FFF;
      font: normal normal normal 14px/1 FontAwesome;
      font-size: 40px;
      text-rendering: auto;
      -webkit-font-smoothing: antialiased;
      border-radius: 2px;
      z-index: 2;
      backface-visibility: hidden;
    }
    &:after {
      content: 'Hi!';
      position: absolute;
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #333;
      color: #FFF;
      font-size: 48px;
      border-radius: 2px;
      transition-delay: .15s;
    }
  }
  &:nth-child(1) .box:before {
    content: "\f09a";
    background: #3f51b5;
  }
  &:nth-child(1) .box:after {
    background: #3f51b5;
  }
  &:nth-child(2) .box:before {
    content: "\f099";
    background: #1da1f2;
  }
  &:nth-child(2) .box:after {
    background: #1da1f2;
  }
  &:nth-child(3) .box:before {
    content: "\f0d5";
    background: #dc4a38;
  }
  &:nth-child(3) .box:after {
    background: #dc4a38;
  }
  &:nth-child(4) .box:before {
    content: "\f0e1";
    background: #006699;
  }
  &:nth-child(4) .box:after {
    background: #006699;
  }
  &:nth-child(5) .box:before {
    content: "\f173";
    background: #36465d;
  }
  &:nth-child(5) .box:after {
    background: #36465d;
  }
  &:nth-child(6) .box:before {
    content: "\f13b";
    background: #f16528;
  }
  &:nth-child(6) .box:after {
    background: #f16528;
  }
  &:nth-child(7) .box:before {
    content: "\f13c";
    background: #0170ba;
  }
  &:nth-child(7) .box:after {
    background: #0170ba;
  }
  &:nth-child(8) .box:before {
    content: "\f19a";
    background: #21759b;
  }
  &:nth-child(8) .box:after {
    background: #21759b;
  }
  &:nth-child(9) .box:before {
    content: "\f09b";
    background: #323131;
  }
  &:nth-child(9) .box:after {
    background: #323131;
  }
  &:nth-child(10) .box:before {
    content: "\f1cb";
    background: #000000;
  }
  &:nth-child(10) .box:after {
    background: #000000;
  }
  &:nth-child(11) .box:before {
    content: "\f268";
    background: #fec540;
  }
  &:nth-child(11) .box:after {
    background: #fec540;
  }
  &:nth-child(12) .box:before {
    content: "\f269";
    background: #ef8043;
  }
  &:nth-child(12) .box:after {
    background: #ef8043;
  }
  &:nth-child(13) .box:before {
    content: "\f282";
    background: #2c74be;
  }
  &:nth-child(13) .box:after {
    background: #2c74be;
  }
  &:nth-child(14) .box:before {
    content: "\f267";
    background: #409ed4;
  }
  &:nth-child(14) .box:after {
    background: #409ed4;
  }
  &:nth-child(15) .box:before {
    content: "\f26a";
    background: #cc0f15;
  }
  &:nth-child(15) .box:after {
    background: #cc0f15;
  }
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.