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
via CSS Lint

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
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


              <div class="box"><img src=""></div>
<p>Click the cat to see some events!</p>
<pre class="display"></pre>


              body {background:#000; margin:3em; color:whitesmoke; font-family: Georgia, serif; perspective: 500px; }

p {text-align: center; margin-top:3em; font-weight:bold; font-style:italic; font-size: 120%;}

.display {
  border-top: 1px solid #666;
   margin: 3em auto;
  padding:1em 4%;

.box {

img { border-radius: 50%;}

.active {
  animation: flip .7s ease-in-out 5 alternate both;

@keyframes flip {
    0% {transform: rotateY(-90deg);}
   30% {transform: rotateY(7deg);}
   60% {transform: rotateY(-7deg);}
  100% {transform: rotateY(0deg);}


var myAnim =  document.querySelector('.box');
var disp = document.querySelector('.display');

myAnim.addEventListener('click', function(){

myAnim.addEventListener('webkitAnimationEnd', onAnimationEnd, false);
myAnim.addEventListener('animationend', onAnimationEnd, false);

myAnim.addEventListener('webkitAnimationStart', onAnimationStart, false);
myAnim.addEventListener('animationstart', onAnimationStart, false);

myAnim.addEventListener('webkitAnimationIteration', onAnimationIteration, false);
myAnim.addEventListener('animationiteration', onAnimationIteration, false);

function onAnimationEnd(e) {
  disp.textContent += "Aw, animation "+ e.animationName + " has ended :("+ "\n" ;

function onAnimationStart(e) {
  disp.textContent += "Yay! Animation "+ e.animationName + " started!!" + "\n" ;

function onAnimationIteration(e) {
  disp.textContent += "Oh, an iteration of "+ e.animationName + "," +e.elapsedTime+"s elapsed."+ "\n"  ;
Loading ..................