cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-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.

            
              <section class="card trans">
  <article class="front">
    <figure>
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/11087/optimus.jpg" alt="Optimus Prime" height="100" width="100">
    </figure>
    <h1>Optimus Prime</h1>
    <button class="btn-one">View profile</button>
  </article>
  <article class="back">
    <p><b>Optimus Prime</b> is a character from the Transformers franchise.</p>
    <p>Prime is the leader of the Autobots, a faction of transforming robots from the planet Cybertron.</p>
    <button class="btn-one">Close</button>
  </article>
</section>

<hr>

<section class="card ani">
  <article class="front">
    <figure>
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/11087/megatron.jpg" alt="Optimus Prime" height="100" width="100">
    </figure>
    <h1>Megatron</h1>
    <button class="btn-two">View profile</button>
  </article>
  <article class="back">
    <p><b>Megatron </b> is the primary antagonist from the Transformers franchise.</p>
    <p>He is a sentient robotic lifeform from the planet Cybertron and the leader of the villainous Decepticons.</p>
    <button class="btn-three">Close</button>
  </article>
</section>
            
          
!
            
              $bezier-card: cubic-bezier(.5,-0.3,.5,1.3);

@import url(https://fonts.googleapis.com/css?family=Roboto:400,300);
* { box-sizing: border-box; }

body {
  font-family: Roboto, san-serif;
  font-weight: 300;
  background-color: #f5f5f5;
}

h1, h3 {
  color: #333;
  font-weight: 300;
}

h1 {
  margin: .25rem 0 .875rem;
  text-align: center;
}

button {
  display: block;
  margin: 0 auto;
  background-color: #f1f1f1;
  border: none;
  outline: none;
  padding: .5rem 1rem;
  border-radius: 30px;
  font-size: 87.5%;
  font-weight: 400;

  &:hover { background-color: #f5f5f5; }
  &:active { background-color: #e5e5e5; }
}

hr {
  display: block;
  height: 1px;
  border: 0;   
  border-top: 1px solid #e5e5e5;
  margin: 3em 0;
  padding: 0;
}

.card {
  position: relative;
  margin: 2em auto;
  width: 300px;
  height: 230px;
  cursor: pointer;
  transform-style: preserve-3d;
  
  /* What might be added below to assist in flipping the card? */
  transform: none;
  transition: none;

  /* What might be added below to flip the card? */
  &.flip-trans { }
  
 
/*  &.flip-in-ani {
    animation: flipInAni .4s forwards $bezier-card;
  }
  
  &.flip-out-ani {
    animation: flipOutAni .4s forwards $bezier-card;
  }*/

  .front,
  .back {
    position: absolute;
    padding: 1rem 1.25rem;
    width: 100%;
    height: 230px;
    color: #666;
    background-color: white;
    border: 1px solid #e5e5e5;
    border-radius: .375rem;
    backface-visibility: hidden;

    p {
      line-height: 1.5;

      &:first-child { margin-top: 0; }
    }
  }

  .front {

    figure {
      margin: 0;
      text-align: center;

      img {
        background-size: 100%;
        border-radius: 50%;
        border: 5px solid rgba(0,0,0,.05)
      }
    }
  }

  .back {
    transform: rotateY(180deg);
    z-index: 0;
  }
}

@keyframes flipInAni {
  from { transform: scale(1) rotateY(0); }
  50% { transform: scale(1.2); } 
  to { transform: scale(1) rotateY(180deg); } 
}

@keyframes flipOutAni {
  from { transform: scale(1) rotateY(180deg); }
  50% { transform: scale(1.2); } 
  to { transform: scale(1) rotateY(0); } 
}
            
          
!
            
              // For transition
$(".btn-one").click(function() {
  $(".card.trans").toggleClass("flip-trans");
});

// For animation
/*$(".btn-two").click(function() {
  $(".card.ani").addClass("flip-in-ani");
  $(".card.ani").removeClass("flip-out-ani");
});

$(".btn-three").click(function() {
  $(".card.ani").removeClass("flip-in-ani");
  $(".card.ani").addClass("flip-out-ani");
});*/
            
          
!
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