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

              
                .header
  #ParallaxImage.header__image(style="background-image: url('https://unsplash.it/1600/850?image=776');")
  #ParallaxContent.header__content
    h1 Parallax header
    h4 Simple vanilla javascript
.copy
  h2 Example Title
  h3 Quisque ullamcorper venenatis velit congue.
  p
    | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer porta sagittis urna eu vulputate. Vestibulum ut turpis sem. Duis vitae nisl lobortis, suscipit dolor non, congue massa. Sed sit amet lectus at neque suscipit luctus. Nulla lorem metus, placerat id aliquet ac, facilisis sed dolor. Nulla quam felis, interdum eget pulvinar et, varius vitae dolor. Maecenas eget mi nec purus tempor fringilla a eget elit. Nunc in laoreet ligula, non cursus arcu. Maecenas vel semper est, ac vehicula ipsum.
  p
    | Nullam malesuada mi vehicula, semper lacus at, pharetra mi. Donec fringilla urna nunc, quis convallis ex imperdiet at. Sed lobortis rutrum nisi. Fusce feugiat varius facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dignissim, massa a pharetra pharetra, elit lectus aliquam urna, eu condimentum dui felis in quam. Quisque vestibulum semper pretium. Sed lacus massa, rutrum vel mauris a, dignissim imperdiet lacus. Quisque semper porttitor ex eu suscipit. Duis malesuada lacus in eleifend ullamcorper.
  p
    | Nullam sed tortor vel nulla placerat imperdiet. Suspendisse quis nisi ut neque sodales semper non nec metus. Integer sit amet lacus nibh. Fusce malesuada molestie dui, vitae cursus lacus pulvinar suscipit. Morbi iaculis orci ac quam vestibulum, sit amet dapibus sapien egestas. Praesent sed nisl felis. Aliquam erat volutpat. Fusce quis elit nibh. Phasellus maximus imperdiet turpis vel ultrices. Etiam laoreet metus leo. Nam at facilisis orci. Donec efficitur sem ac posuere elementum. Pellentesque consectetur aliquam lobortis. Pellentesque consectetur aliquam lobortis.

              
            
!

CSS

              
                *, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background-color: #f2f2f2;
}

h1 {
  font-family: 'Playfair Display', sans-serif;
  font-size: 110px;
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  margin: 0 0 20px 0;
}

h2 {
  font-family: 'Playfair Display', sans-serif;
  font-size: 70px;
  font-weight: 900;
  color: #262626;
  margin: 0 0 10px 0;
}

h3 {
  font-family: 'Lato', sans-serif;
  font-size: 24px;
  font-weight: 300;
  color: #262626;
  margin: 0 0 60px 0;
}

h4 {
  font-family: 'Lato', sans-serif;
  font-size: 28px;
  font-weight: 300;
  color: #fff;
  margin: 0 0 0 0;
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.header__image {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
}

.header__content {
  text-align: center;
  position: relative;
  z-index: 50;
}

.copy {
  text-align: center;
  padding: 60px 25px 55px 25px;
  width: 675px;
  margin: 0 auto;
}

p {
  font-family: sans-serif;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.95;
  color: #262626;
  margin: 0 0 30px 0;
}
              
            
!

JS

              
                 function windowScroll() {
  var parallaxImage = document.getElementById('ParallaxImage'),
      parallaxContent = document.getElementById('ParallaxContent'),
      windowScrolled = window.pageYOffset || document.documentElement.scrollTop,
      speedImage = 4,
      speedContent = 6;

  parallaxImage.style.transform = 'translate3d(0, ' + windowScrolled / speedImage + 'px, 0)';
  parallaxContent.style.transform = 'translate3d(0, ' + windowScrolled / speedContent + 'px, 0)';
}

window.addEventListener('scroll', windowScroll);
              
            
!
999px

Console