cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
  <div class="card">
    <div class="front">
      <h1>Next flight in 13 days</h1>
      <i class="fa fa-plane js-triggerFlip" aria-hidden="true"></i>
    </div>

    <div class="back">
      <i class="fa fa-chevron-left reverseFlip js-reverseFlip" aria-hidden="true"></i>
      
      <h2>AUS <i class="fa fa-plane" aria-hidden="true"></i> BOS</h2>

      <ul>
        <li>
          <h3>Flight</h3>
          <p>JB 1038</p>

          <h3>Terminal</h3>
          <p>C</p>
        </li>
        <li>
          <h3>Seat</h3>
          <p>3A</p>

          <h3>Gate</h3>
          <p>C17</p>
        </li>
      </ul>
      
      <img class="barcode" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/93/barcode.svg">
      
      <label for="modal-details" class="view-button">View Details</label>
      <input type="checkbox" id="modal-details" class="details-trigger">
      
      <div id="modal-details">
        <label for="modal-details" class="close"><i class="fa fa-times-circle-o" aria-hidden="true"></i></label>
        
        <h4>Flight Details</h4>
        <p>You've purchased a codevember fare. This fare option does not include checked bags. You may pay for bags online (within 24 hours of departure), or upon arrival at the airport via an airport kiosk or with an airport crewmember. Some restrictions apply.</p>
        
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc iaculis lorem eget sagittis tincidunt. Vestibulum porttitor vestibulum sapien, a gravida tortor malesuada eu. Nunc vulputate rutrum lorem eget luctus. Praesent tellus ante, sagittis id consectetur a, hendrerit quis dui. Aliquam at dapibus nulla, sit amet congue diam. Duis sed sodales enim.</p>
      </div>
    </div>
  </div>
</div>

<p class="view-collection">&bull; #codevember &bull; <a href="https://codepen.io/collection/nxZbMW/" target="_blank">View Collection</a> &bull;<br />
  <span>Handcrafted with <span class="love">♥</span> from Austin, TX by <a href="https://twitter.com/fleetingftw">James Fleeting</a></span></p>
            
          
!
            
              @use postcss-simple-vars;
@use postcss-media-minmax;
@use postcss-nested;

$width: 350px;
$height: 400px;
$white: #f6f6f6;
$blue: #6c7486;
$light_blue: #dfe1e6;
$gray: #c9c9c9;

* {
  box-sizing: border-box;
}

.container {
  position: relative;
  margin: 85px auto;
  width: $width;
  height: $height;
  perspective: 800px;
  
  &.flip .card {
    transform: rotateY(-180deg);
  }
}

.card {
  position: relative;
  width: $width;
  transition: all 800ms 0.8s ease-out;
  transform-style: preserve-3d;
}

.front, .back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: $width;
  height: $height;
  border-radius: 10px;
}

.front {
  z-index: 2;
  transform: rotateY(0deg);
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/93/boston-skyline.jpg) no-repeat center center;
  background-size: cover;
  
  h1 {
    margin: 19px;
    padding: 10px 8px;
    color: $white;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    text-align: center;
    text-transform: uppercase;
    background: $blue;   
  }
  
  i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    padding: 25px;
    width: 50px;
    height: 50px;
    color: #fff;
    font-size: 25px;
    border-radius: 100px;
    background: rgba(108, 116, 134, 0.75);
    transition: all 0.8s;
    cursor: pointer;
    
    &::before {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
      width: 20px;
      height: 20px;
    }
    
    &:hover {
      background: $blue;
    }
  }
}

.container.flip {
  .front h1 {
    animation: fade-out 0.55s both;
  }
  
  .front i {
    animation: background-fade 0.55s linear both;
    
    &::before {
      animation: fly-out 2s linear both;
    }
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  
  to {
    opacity: 0;
  }
}

@keyframes background-fade {
  from {
    background: $blue;
  }
  
  to {
    background: transparent
  }
}

@keyframes fly-out {
  20% {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(1000px, -1000px, 0);
  }
}

.back {
  padding: 25px;
  color: $blue;
  text-align: center;
  background: $white;
  transform: rotateY(180deg);
  
  h2 {
    margin: 0 0 25px;
    font-family: 'Open Sans', sans-serif;
    font-size: 40px;
    
    i {
      padding: 0 15px;
      font-size: 25px;
      vertical-align: middle;
      opacity: 0.5;
    }
  }
  
  ul {
    margin: 0;
    padding: 0;
    border: 2px solid $light_blue;
    border-left: 0;
    border-right: 0;
    text-align: left;
    list-style: none;
  }
  
  li {
    display: inline-block;
    width: 49%;
    padding: 0 20px;
    
    &:first-child {
      border-right: 2px solid $light_blue;
    }
  }
  
  h3 {
    margin: 25px 0 8px;
    font-size: 12px;
    font-family: 'Open Sans', sans-serif;
    color: $gray;
    text-transform: uppercase;
  }
  
  p {
    margin: 0 0 25px;
    font-size: 20px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
  }
  
  i.reverseFlip {
    position: absolute;
    top: 13px;
    left: 13px;
    color: #222;
    cursor: pointer;
  }
  
  .barcode {
    position: absolute;
    bottom: 15px;
    left: 39px;
    width: 110px;
    opacity: 0.65;
  }
  
  .view-button {
    position: absolute;
    bottom: 47px;
    right: 34px;
    padding: 14px 30px;
    color: $white;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    background: $blue;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.4s;
    opacity: 0.8;
    cursor: pointer;
    
    &:hover {
      opacity: 1;
      border-radius: 7px;
    }
  }
  
  .details-trigger {
    width: 0;
    height: 0;
    opacity: 0;
  }
  
  .details-trigger:checked + #modal-details {
    pointer-events: all;
    opacity: 1;
    height: 100%;
  }
}

.container.flip .back h2 i {
  transform: translate3d(-1000px, 1000px, 0);
  animation: fly-in 1.4s 1.3s linear both;
}

@keyframes fly-in {
  30% {
    transform: translate3d(-1000px, 1000px, 0);
  }

  to {
    transform: translate3d(0, 0, 0);
  }
}

#modal-details {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 25px;
  opacity: 0;
  height: 0;
  text-align: left;
  color: $white;
  background: $blue;
  border-radius: 10px;
  pointer-events: none;
  transition: opacity 0.5s, height 0.8s;
  
  h4 {
    margin-bottom: 10px;
  }
  
  p {
    font-size: 13px;
    font-weight: 400;
  }
  
  label.close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: $white;
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
  }
}

body {
  background: radial-gradient(ellipse at center, #343436 0%,#1d1f20 100%);
}

.view-collection {
  margin: 10px 0 35px;
  color: #fff;
  text-align: center;
  font-size: 15px;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  
  span {
    font-size: 13px;
  }
  
  .love {
    color: #cc0000;
  }
  
  a {
    color: $blue;
    text-decoration: none;
    transition: all 0.7s;
    
    &:hover, &:focus {
      color: #fff;
    }
  }
}

            
          
!
            
              let cardContainer = document.querySelector('.container');
let flipTrigger = document.querySelector('.js-triggerFlip');

if(flipTrigger) {    
  flipTrigger.addEventListener('click', function(event) {
    event.preventDefault();
    
    cardContainer.classList.toggle('flip');
  });
};

let reverseFlip = document.querySelector('.js-reverseFlip');
if(reverseFlip) {    
  reverseFlip.addEventListener('click', function(event) {
    event.preventDefault();
    
    cardContainer.classList.toggle('flip');
  });
};
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console