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 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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <!-- From a design by Tom Lenartowicz from his Penguin Horror book series.   
https://bit.ly/2kiSLXm
--> 
<div id="wrap" class="wrap animate">
  <div class="sky"></div>
  <div class="water"></div>
  <span class="letter j">J</span>
  <span class="letter a">A</span>
  <span class="letter w">W</span>
  <span class="letter s">S</span>
  <div class="meta-wrap">
    <hr>
    <div class="meta-content">
      <div class="author">
        Written by<br>
        Peter Benchley
      </div>
      <div class="publisher">
        Penguin<br>
        Horror
      </div>
    </div>
  </div>
  <div class="spine"></div>
</div>

<button onclick="rerun()">Again</button>
            
          
!
            
              $letter-animation: move-letter 3s ease-out forwards;
$unmurkify: unmurkify 4s forwards ease-out 1s;
$bookify: bookify 2s forwards 4s;

*{box-sizing: border-box;}

//we're gonna need a bigger boat
html { 
  height: 100%; 
}
body {
  height: 100%;
  font-family: 'Josefin Sans', sans-serif;
  background: linear-gradient(to top, #457fca, #5691c8);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.wrap {
  width: 25em;
  height: 35em;
  position: relative;
  overflow: hidden;
  margin-bottom: 1em;
  //replica of the water div, to show behind water when water becomes less murky 
  background: linear-gradient(to bottom, #fff 25%, #2a8d96 25%, #6b5555 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  
  
  &.animate {
    .water {
      animation: $unmurkify;
    }
    .letter {
      animation: $letter-animation;  
    }
    .meta-wrap, .spine {
      animation: $bookify;
    }
  }
}
.sky {
  background: #f0f1f5;
  position: relative;
  height: 25%;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 5;
}
.water {
  height: 75%;
  width: 100%;
  bottom: 0; left: 0;
  background: linear-gradient(to bottom, #2a8d96, #6b5555);
  position: relative;
  z-index: 15;
  opacity: 1;
}
.letter {
  z-index: 3;
  position: absolute;
  top: 19%;
  font-size: 7em;
  font-weight: bold;
  text-align: center;
  color: #333;
}

//a bit yuck, but to get different layering this seemed the best solution
.j { left: 12%; }
.a { left: 27%; z-index: 10; }
.w { left: 46%; }
.s { left: 75%; }

.meta-wrap {
  position: absolute;
  z-index: 20;
  bottom: 0; left: 0;
  width: 100%;
  text-transform: uppercase;
  color: #eee;
  font-size: 0.6em;
  padding: 0 2em 2em;
  opacity: 0;
  
  hr {
    height: 1px;
    color: #ddd;
    background: #ddd;
    font-size: 0;
    border: 0;
  }
}
.meta-content {
  padding-top: 1em;
  display: flex;
  justify-content: space-between;
}
.publisher { text-align: right; }
.spine {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient( to right, transparent 0.3em, rgba(0,0,0,0.1) 0.6em, rgba(0,0,0,0.05) 0.9em, rgba(255,255,255,0.1) 1em, rgba(255,255,255,0.05) 1em, transparent 1.1em );
  z-index: 30;
  top: 0; left: 0;
  background-size: 100px 1em;
  background-repeat: repeat-y;
  opacity: 0;
}
@keyframes move-letter {
  0% { transform: translateX(1em) translateY(0.1em); }
  100% { transform: translateX(0) translateY(0); }
}
@keyframes unmurkify {
  0% { opacity: 1; } 
  40% { opacity: 1; }
  100% { opacity: 0.7; }
}
@keyframes bookify {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
button {
  border: none;
  background: #333;
  color: #ddd;
  border-radius: 20px;
  height: 30px;
  padding: 0 15px;
  letter-spacing: 1px;
  font-size: 14px;
  z-index: 40;
  cursor: pointer;
}
            
          
!
            
              function rerun() {
  var elem = document.getElementById('wrap');
  elem.className = 'wrap';
  setTimeout(function () {
    elem.className = 'wrap animate';
  }, 50);
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console