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.

            
              <!-- 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
Loading ..................

Console