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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <input type="checkbox" id="toggle-1">
<label class="container" for="toggle-1">
  <div class="card front"></div>
  <div class="card back">i am back</div>
</label>
 <h3>Click image to flip</h3>
              
            
!

CSS

              
                /* ==========================================
We use the Checkbox hack to activate the flipping.
No JS needed.
https://css-tricks.com/the-checkbox-hack/

Anything marked 'for codepen' is just for presentation inside of codepen.
========================================== */


body { text-align: center; } /* for codepen*/ 

input[type=checkbox] { 
  /*Hiding the checkbox. We never want to see it.*/
  position: absolute; left: -9999em; 
}

.container {
  /*for codepen*/ 
  margin:2em auto 0;
  
  /*Animation elements*/
  display: block;
  perspective: 600px;
  position: relative;
  transition: all .1s;
  width: 250px; height:250px;
  
  &:hover { 
    /*Make it a little bigger on hover,
    to indicate that it can be clicked on.*/
    transform: scale(1.05,1.05); 
  }
}

.card {
  cursor: pointer; /*Another clue that this can be clicked on*/
  position: absolute; top: 0; left: 0;
  width: inherit; height: inherit; /*Size of the card is set by the container*/
  
  backface-visibility: hidden; /*Makes a card invisible from behind.*/
  transform-style: preserve-3d;
  transition: all .4s ease-in-out;
}
.front {
  /*Background stuffs for codepen*/
  background: url('https://farm2.staticflickr.com/1005/525373055_04e1e02c0b.jpg') no-repeat;
  background-size: cover;
  
  /*Default rotation values*/
  transform: rotateX(0deg) rotateY(0deg);
}
.back {
  background: MediumPurple; /*for codepen*/
  
  visibility: hidden; 
  /*Default rotation value*/
  transform: rotateY(-180deg);
}

/*When the container is clicked the checkbox is marked as checked. This activates the CSS below. */
input[type=checkbox]:checked {
  ~ .container {
    animation: lift .4s linear;
    .card {
      animation: lift-shadow .4s linear;
    }
    .back {
      visibility: visible;
      transform: rotateX(0deg) rotateY(0deg);  
    }
    .front {
      transform: rotateY(180deg);
    }
  }
}

@keyframes lift {
  0% {
    transform: scale(1,1);
  }
  20% {
    transform: scale(1.2,1.2);
  }
  80% {
    transform: scale(1.1,1.1);
  }
  100% {
    transform: scale(1,1);
  }
}
@keyframes lift-shadow {
  0% {
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
  }
  20% {
    box-shadow: 0 0 35px rgba(0,0,0,0.6);
  }
  80% {
    box-shadow: 0 0 35px rgba(0,0,0,0.6);
  }
  100% {
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console