startv

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.

HTML

            
              <article class='glass down'>
  <h1 class='toggle' onclick='toggle()'>Pelican</h1>
  <p class='unimportant'><em>Pel"i*can</em>, n. Etym: [F. p&eacute;lican, L. pelicanus, pelecanus, Gr. para&ccedil;u.] [Written also pelecan.] 1. (Zo&ouml;l.)</p>

  <p><em>Defn:</em> Any large webfooted bird of the genus of Pelecanus, of which about a dozen species are known. They have an enormous bill, to the lower edge of which is attached a pouch in which captured fishes are temporarily stored.

    <p class='unimportant'><em>Note:</em> The American white pelican (Pelecanus erythrorhynchos) and the brown species (P. fuscus) are abundant on the Florida coast in winter, but breed about the lakes in the Rocky Mountains and British America.</p>
</article>
<!-- Image by Yair Hazout via unsplash.com -->
<!-- Text from Webster's Unabridged Dictionary via Project Gutenberg -->
            
          
!

CSS

            
              /* LAYOUT */
html, body, article, .glass::before {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.glass {
  position: relative;
}

.glass::before {
  z-index: -1;
  display: block;
  position: absolute;
  content: ' ';
}

/* BACKGROUNDS */
body {
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/28727/pelican.jpg');
  background-size: cover;
}

.glass::before {
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/28727/pelican-blurred.jpg');
  background-size: cover;
  opacity: 0.4;
}

.glass {
  background-color: white;
}

/* TRANSFORMATIONS */
.glass.down {
  /* Fallback for browsers that don't support 3D Transforms */
  transform: translateY(100%) translateY(-7rem);
  transform: translateY(100%) translateY(-7rem) translateZ(0);
}

.glass.down::before {
  transform: translateY(-100%) translateY(7rem);
  transform: translateY(-100%) translateY(7rem) translateZ(0);
}

.glass.up, .glass.up::before {
  transform: translateY(0);
  transform: translateY(0) translateZ(0);
}

/* TRANSITIONS */
.preload * {
  transition: none !important;
}

.glass, .glass::before {
  transition: transform 0.5s ease-out;
}

/* TYPOGRAPHY, ETC */
body {
  font-family: 'Source Sans Pro', Verdana, sans-serif;
  font-size: 100%;
}

h1 {
  font-size: 5rem;
  line-height: 1.4;
  font-weight: bold;
  text-align: center;
  padding: 0 7rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

h1::before {
  position: absolute;
  left: 0;
  top: 0;
  background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/28727/double-chevron-up.svg');
  content: ' ';
  display: block;
  width: 7rem;
  height: 7rem;
  transition: transform 0.2s ease-out 0.5s;
}

.up h1::before {
  transform: rotate(180deg);  
}

em {
  font-style: normal;
  font-weight: bold;
}

p {
  font-size: 1.8rem;
  line-height: 1.4;
  max-width: 30em;
  margin: 1.4em auto;
  padding: 0 1em;
}

@media (max-width: 500px), (max-height: 300px) {
  p.unimportant {
    display: none;
  }
  p {
    font-size: 1.4rem;
    margin: 0.5em auto;
  }
}

            
          
!

JS

            
              function toggle() {
  var button = document.querySelector('.toggle');
  var overlay = document.querySelector('.glass');
  if (overlay.className === 'glass down') {
    overlay.className = 'glass up';
  } else {
    overlay.className = 'glass down';
  }
}

window.onload = function() {
  /* transition support ~= classList support */
  var preload = document.querySelector('.preload');
  preload.classList.remove('preload');
}

            
          
!
999px
Loading ..................

Console