Pen Settings



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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


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


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.


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.


                <div style='margin:200px; position:relative;'>
 <div id='box' class='FadeInBox'></div><div id='coin' class='CoinJump'>$1</div>


                .FadeInBox{ width:100px; height:100px;
    background-color:red; opacity:0.1; z-index:2;
    animation:myFadeIn 4000ms infinite; }

@keyframes myFadeIn  { 0%{opacity:5%; }
                      85%{opacity:100%; }
                      88% {opacity:1%;}
                      100%{opacity:5%; } }

.CoinJump { opacity:0; position: absolute;
        width: 20px; height: 20px;  margin-left:20px;
        color:white; font-size:11px; font-weight:600; text-align:center; padding-top:5px;
        top:100px; z-index:-2; 
        border-radius: 50%; 
        animation: myJump 4000ms  infinite;
        animation-timing-function: cubic-bezier(.26,.68,.29,.84);

@keyframes myJump  { 0% { opacity:0; }
                    60% { opacity:0; }
                    65% { opacity:1; left:0; top:0; transform:rotateY(0); }
                    95% { opacity:1; }
                   100% { opacity:0; top:-150px; left:75px; transform:rotateY(420deg); } }



                document.getElementById('coin').addEventListener('animationiteration', listener, false); 
function listener(e) { randomizeCoinJumpFinale(); } //listen for each iteration

function randBetween(lo,hi){ return (Math.round(Math.random()*(hi-lo)))+lo }  

function findKeyframesRule(rule) {  //get object of our rule
  var ss = document.styleSheets; // get array of stylesheets
  for (var i = 0; i < ss.length; ++i) {// loop thru stylesheets
    for (var j = 0; j < ss[i].cssRules.length; ++j) { // loop thru rules
      if (ss[i].cssRules[j].name == rule){
        //if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE)  //***update WEBKIT***
          return ss[i].cssRules[j];
  console.log('%cRules not found for '+rule,'background-color:red;'); // rule not found
  return null;  

function randomizeCoinJumpFinale(){
  var rules = findKeyframesRule('myJump');
  var rnd_top=randBetween(-200,-100), rnd_left=randBetween(-75,75), rnd_rotate=randBetween(360,777);
  rules.appendRule("100% { opacity:0; top:"+rnd_top+"px; left:"+rnd_left+"px; transform:rotateY("+rnd_rotate+"deg); }");
  console.log("%cUPDATED RULE:%ctop="+rnd_top+", left="+rnd_left+", rotate="+rnd_rotate,"background-color:green;","background-color:none;");
  //console.log(rules.findRule("100%"));  //display new rule

function UselessRainbow(){   //pointless
  console.log('%c\uD83D\uDE09 Randomize Keyframe Animations!', 'font-weight:bold; font-size:50px;color:red; text-shadow:3px 3px 0 red,6px 6px 0 orange,9px 9px 0 yellow,12px 12px 0 green,15px 15px 0 blue,18px 18px 0 indigo,21px 21px 0 violet');