Pen Settings

HTML

CSS

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

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

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.

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 class="hero">
        <div class="container">
            <a class="logo" href="#">
                <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/logo.png" alt="Logo">
            </a>
            <div class="hands"></div>
            <div class="book"></div>
            <div class="skull"></div>
            <div class="flowers"></div>
        </div>
    </header>
    <main class="content">
        <div class="container">
            <p>Lorem ipsum dolor amet cardigan tumeric flannel ethical fixie, poutine church-key cliche taxidermy mustache slow-carb schlitz hashtag. Truffaut poutine you probably haven't heard of them pork belly listicle vinyl jianbing kombucha. Slow-carb disrupt chartreuse, truffaut williamsburg ramps DIY cronut distillery. Meh pork belly letterpress, fingerstache VHS ethical vape you probably haven't heard of them. Stumptown pitchfork etsy kinfolk pabst. Heirloom copper mug sartorial cornhole. PBR&B raw denim chicharrones chia pabst helvetica wayfarers waistcoat viral bespoke.</p>

            <p>Shabby chic synth biodiesel squid tattooed forage meditation yuccie, 3 wolf moon banh mi tumblr master cleanse. Marfa chicharrones brunch kitsch trust fund bushwick schlitz pitchfork post-ironic gochujang unicorn. Kombucha godard migas pinterest narwhal, air plant banjo wayfarers try-hard activated charcoal glossier normcore. Stumptown chillwave cardigan etsy actually banjo. Stumptown fashion axe meggings keytar blue bottle. Semiotics cray tumeric migas fanny pack lyft beard hot chicken seitan. Echo park put a bird on it kickstarter, tattooed deep v selvage narwhal banh mi poutine scenester photo booth truffaut DIY.</p>

            <p>Irony pok pok intelligentsia meh photo booth. Wayfarers ethical viral, adaptogen neutra chartreuse shoreditch pitchfork semiotics tousled irony. Taxidermy fam food truck ugh tofu freegan. Tbh lo-fi biodiesel poutine activated charcoal godard vinyl truffaut austin. Street art four dollar toast hashtag hammock, actually authentic next level deep v quinoa chia.</p>

            <p>Meh food truck pok pok, hexagon shabby chic authentic neutra woke mixtape pinterest trust fund umami blue bottle. 90's jean shorts chicharrones sustainable, brunch banh mi skateboard la croix narwhal DIY offal microdosing put a bird on it readymade small batch. Man braid VHS chillwave helvetica PBR&B retro shabby chic iPhone kogi iceland echo park dreamcatcher actually. DIY keytar hoodie street art intelligentsia. Raclette paleo echo park truffaut, vegan meggings shoreditch neutra vexillologist chia kickstarter. Thundercats next level readymade bitters ethical butcher chillwave stumptown fixie keytar trust fund selvage cold-pressed adaptogen vice. Etsy lo-fi poke beard bushwick, asymmetrical authentic you probably haven't heard of them pok pok.</p>

            <p>Meditation raclette church-key craft beer umami fanny pack activated charcoal listicle meh chicharrones 8-bit poutine. Normcore DIY tote bag taiyaki organic. Sartorial poke pabst pour-over dreamcatcher palo santo ethical williamsburg polaroid. Kitsch meh photo booth health goth kogi blog pug tilde synth narwhal skateboard ugh woke. Vaporware enamel pin salvia health goth flexitarian glossier truffaut. Prism VHS godard, fanny pack affogato craft beer actually chambray woke chicharrones truffaut succulents brooklyn. Marfa banh mi vegan master cleanse.</p>

        </div>
    </main>
              
            
!

CSS

              
                
html body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    line-height: 40px;
}

.hero {
    display: flex;
    justify-content: center;
    height: 600px;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/table-bg.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    overflow: hidden;
}

.hero .container {
    position: relative;
    height: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
}

.content {
    margin: 80px 0;
    display: flex;
    justify-content: center;
}

/* Parallax Elements */
.logo {
    position: absolute;
    width: 130px;
    top: 20px;
    left: 0;
    right: 0;
    margin: auto;
    display: block;
    z-index: 1;
}
.logo img {
    display: block;
    width: 130px;
}
.hands {
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    width: 525px;
    height: 347px;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/hands.png');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 2;
}

.book {
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    width: 480px;
    height: 361px;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/book.png');
    background-size: contain;
    background-repeat: no-repeat;
    bottom: -240px;
}

.skull {
    position: absolute;
    align-self: center;
    top: 200px;
    left: 8%;
    width: 180px;
    height: 161px;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/skull.png');
    background-size: contain;
    background-repeat: no-repeat;
}

.flowers {
    position: absolute;
    right: 0;
    top: 10%;
    width: 320px;
    height: 280px;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/513927/flowers.png');
    background-size: contain;
    background-repeat: no-repeat;
}





              
            
!

JS

              
                const hands = document.querySelector('.hands'),
      book = document.querySelector('.book'),
      skull = document.querySelector('.skull'),
      flowers = document.querySelector('.flowers'),
      logo = document.querySelector('.logo');   

window.addEventListener('scroll', e => {
  const heroHeight = document.querySelector('.hero').clientHeight;
  let scroll = window.scrollY;

  if(scroll <= heroHeight) {
    hands.style.transform = `translate(0px, -${scroll / 13}%)`;
    skull.style.transform = `translate(0px, ${scroll / 3}%)`;
    book.style.transform = `translate(0px, -${scroll / 5}%)`;
    flowers.style.transform = `translate(0px, ${scroll / 4}%)`;
    logo.style.transform = `translate(0px, ${scroll / 1.2}%)`;
  }
});
              
            
!
999px

Console