Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                    <div class="article-container">
      <header class="header">
        <svg class="example-logo" width="2000px" height="2000px" viewBox="-400 -400 1000 1000" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
          <g id="icon-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
            <circle class="rellax" data-rellax-speed="-1" stroke="#000000" stroke-width="3" fill="#333333" style="opacity:.5" cx="100.5" cy="100.5" r="100.5"></circle>
            <circle class="rellax" data-rellax-speed="-.5" stroke="#000000" stroke-width="3" fill="#aaa" style="opacity:.5" opacity="0.9" cx="100.5" cy="99.225" r="79.875"></circle>
            <g class="rellax" data-rellax-speed="2">
              <g class="large-boulder" transform="translate(33.000000, 57.000000)">
                <polygon fill="#E6E7E8" points="36 0.15 83.025 0.15 99 12.525 102.6 24.9 134.1 68.775 106.275 78.6 61.275 73.425 8.625 75.45 0.9 61.125 0.9 44.475 12.225 37.8 23.625 16.2"></polygon>
                <path d="M8.25,74.325 L31.425,59.7 L47.85,58.5 L64.95,60.6 L83.025,50.325 L108.3,57.15 L134.1,68.775 L106.275,78.6 L61.275,73.425 L37.05,74.1 L8.25,74.325 Z M18.15,27.45 L34.425,28.125 L39.075,33.15 L22.05,39.375 L7.425,51.3 L0.9,45.45 L10.5,38.775 L18.15,27.45 Z M71.175,25.875 L73.875,19.2 L83.85,15.9 L97.5,27.225 L84.375,23.1 L75.825,27.225 L71.175,25.875 Z M37.425,38.85 L58.725,33.15 L70.95,36.375 L79.2,42.525 L74.55,48.225 L59.175,49.275 L45.75,51 L32.85,50.325 L27.225,56.4 L16.35,52.8 L37.425,38.85 Z" fill="#D1D3D4"></path>
                <polygon id="body" stroke="#000000" stroke-width="3" points="36 0.15 83.025 0.15 99 12.525 102.6 24.9 134.1 68.775 106.275 78.6 61.275 73.425 8.625 75.45 0.9 61.125 0.9 44.475 12.225 37.8 23.625 16.2"></polygon>
              </g>
            </g>
            <g class="rellax" data-rellax-speed="1.5">
              <g class="medium-boulder" transform="translate(108.750000, 125.250000)">
                  <polygon fill="#F1F2F2" points="0.525 14.025 10.5 3.3 30.675 0.15 38.925 7.05 43.05 20.85 24.45 27.375 4.575 24.75"></polygon>
                  <polygon fill="#D1D3D4" points="0.525 13.8 18.6 19.35 30.975 18.225 40.275 11.55 43.05 20.625 24.45 27.225 4.575 24.525"></polygon>
                  <polygon stroke="#000000" stroke-width="3" points="0.525 13.8 10.5 3.075 30.675 0 38.925 6.9 43.05 20.625 24.45 27.225 4.575 24.525"></polygon>
              </g>
            </g>
            <g class="rellax" data-rellax-speed="1.25">
              <g class="small-boulder" transform="translate(70.500000, 123.750000)">
                  <polygon fill="#F1F2F2" points="8.85 2.925 20.025 0 31.125 8.475 33.9 19.425 11.025 26.1 0.225 16.725 5.1 3.825"></polygon>
                  <polygon fill="#E6E7E8" points="3.9 6.975 14.325 17.625 26.1 12 32.025 12.075 33.9 19.425 11.025 26.1 0.525 15.6"></polygon>
                  <polygon stroke="#000000" stroke-width="3" points="8.85 2.925 20.025 0 31.125 8.475 33.9 19.425 11.025 26.1 0.225 16.725 5.1 3.825"></polygon>
              </g>
            </g>
          </g>
        </svg>
        <h1 class="heading rellax" data-rellax-speed="-5">MOON ROCKS</h1>
      </header>
      <article class="content">

        <p>"No nation which expects to be the leader of other nations can expect to stay behind in this race for space. We choose to go to the Moon in this decade and do the other things, not because they are easy, but because they are hard."</p>

        <div class="floating-rocks front-one rellax" data-rellax-speed="8">
          <img src="https://cssanimation.rocks/levelup/public/03/04-end/images/rock1.svg">
        </div>

        <p>"10, 9, ignition sequence start, 6, 5, 4, 3, 2, 1, zero. All engines running. Liftoff! We have a liftoff!"</p>

        <div class="floating-rocks back-one rellax" data-rellax-speed="-2" data-rellax-percentage="0.5">
          <img src="https://cssanimation.rocks/levelup/public/03/04-end/images/rock3.svg">
        </div>

        <p>"Houston, Tranquility Base here. The Eagle has landed."</p>

        <div class="floating-rocks front-two rellax" data-rellax-speed="3" data-rellax-percentage="0.5">
          <img src="https://cssanimation.rocks/levelup/public/03/04-end/images/rock2.svg">
        </div>

        <p>"Here we first set foot upon the Moon. July 1969 AD. We came in peace for all mankind."</p>

        <div class="floating-rocks back-two rellax" data-rellax-speed="-3" data-rellax-percentage="0.5">
          <img src="https://cssanimation.rocks/levelup/public/03/04-end/images/rock4.svg">
        </div>

        <p>"This is the LM pilot. I'd like to take this opportunity to ask every person listening in, whoever and wherever they may be, to pause for a moment and contemplate the events of the past few hours and to give thanks in his or her own way."</p>

        <div class="floating-rocks planet-earth rellax" data-rellax-speed="-4" data-rellax-percentage="0.5">
          <img src="https://cssanimation.rocks/levelup/public/03/04-end/images/earth.png" width="100">
        </div>

        <p>"That's one small step for man, a giant leap for mankind."</p>

      </article>

      <footer>
        <h1 class="heading rellax" data-rellax-speed="-2" data-rellax-percentage="0.5">MOON ROCKS</h1>
        <p class="credit">Images from <a href="https://www.flickr.com/photos/projectapolloarchive/albums">NASA</a> &middot;
        Parallax by <a href="https://github.com/dixonandmoe/rellax">Rellax.js</a> &middot;
        <a href="http://courses.cssanimation.rocks/p/level-up">Learn CSS animation</a></p>
      </footer>

    </div>

              
            
!

CSS

              
                header {
  align-items: center;
  background: #000 url(https://cssanimation.rocks/levelup/public/03/04-end/images/moon.jpg) center no-repeat;
  background-size: 100% auto;
  display: flex;
  height: 100vh;
  position: relative;
  overflow: hidden;
  justify-content: center;
  width: 100vw;
}

header:after {
  content: "";
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1));
  position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.example-logo {
  z-index: 10;
}

.heading {
  color: white;
  font-size: 6em;
  line-height: 1;
  margin: 0;
  position: absolute;
    right: 0;
    left: 0;
    bottom: 10vh;
  text-align: center;
}

.content {
  position: relative;
}

.content p {
  transform: translateZ(0);
  z-index: 10;
}

.floating-rocks {
  position: absolute;
}

.front-one {
  right: -10em;
}

.front-two {
  left: -12em;
}

.back-one {
  left: -4em;
  opacity: .2;
  z-index: 0;
}

.back-two {
  right: -20em;
  opacity: .1;
  z-index: 0;
}

.planet-earth {
  border-radius: 50%;
  left: -5em;
  opacity: .8;
  z-index: 0;
}

footer {
  background-size: cover;
  background: url(https://cssanimation.rocks/levelup/public/03/04-end/images/moon2.jpg) top center no-repeat;
  height: 1014px;
  margin-top: 10em;
  position: relative;
}

footer .heading {
  color: rgba(0,0,0,1);
  top: 40%;
  bottom: auto;
}

.credit {
  font-size: 1.75em;
  text-align: center;
  margin: 0;
  position: absolute;
    top: auto;
    right: 0;
    bottom: .5em;
    left: 0;
}

              
            
!

JS

              
                var rellax = new Rellax('.rellax');

              
            
!
999px

Console