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

              
                .parallax
  .mountains
    .peak.p0
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-0.svg" alt="mountain peak")
    .peak.p1
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-1.svg " alt="mountain peak")
    .peak.p2
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-2.svg " alt="mountain peak")
    .peak.p3
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-3.svg " alt="mountain peak")
    .peak.p4
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-4.svg " alt="mountain peak")
    .peak.p5
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-5.svg " alt="mountain peak")
    .peak.p6
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-6.svg " alt="mountain peak")
    .peak.p7
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-7.svg " alt="mountain peak")
    .peak.p8
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-8.svg " alt="mountain peak")
    .peak.p9
      img(src="https://res.cloudinary.com/nathanj-me/image/upload/v1424406215/mountain-9.svg " alt="mountain peak")

    .peak
      .overlay

    .logo
      h1 SCROLL

  main
    article(title="Lorem")
      h1 LOREM
      p This effect is achieved with pure CSS. See #[a(target="_blank" href="https://keithclark.co.uk/articles/pure-css-parallax-websites/") this article] for the technique.
      p Single-origin coffee gastropub kale chips leggings try-hard. Roof party Brooklyn fap, bicycle rights organic disrupt food truck. Cred mustache chillwave selvage Banksy. Slow-carb artisan skateboard Thundercats, next level Brooklyn fixie. Forage photo booth sustainable 3 wolf moon, quinoa Bushwick direct trade viral gentrify cronut listicle ethical. Post-ironic readymade sriracha, drinking vinegar aesthetic gastropub messenger bag. Retro Echo Park meditation, ennui Kickstarter paleo fashion axe. Hashtag cardigan scenester distillery Banksy, lumbersexual gastropub. Pickled tousled retro, umami food truck biodiesel Austin. Hoodie Truffaut four dollar toast banh mi, artisan master cleanse narwhal flexitarian. Bespoke direct trade Williamsburg umami, paleo Carles synth. Mlkshk bitters scenester, mumblecore direct trade narwhal hella sriracha cliche leggings twee paleo wayfarers. American Apparel locavore street art, actually Carles trust fund ethical. Beard meh organic, try-hard pickled sriracha +1 small batch narwhal hella cornhole chambray synth drinking vinegar.
      p Drinking vinegar quinoa fixie aesthetic organic, kale chips literally master cleanse Neutra Helvetica cardigan. Pickled brunch literally vegan viral 8-bit. Art party kogi gluten-free fingerstache, DIY pork belly put a bird on it hashtag 3 wolf moon tote bag chia. PBR&B Tumblr Austin, Odd Future XOXO vegan flexitarian keytar gastropub beard mumblecore skateboard lomo bespoke. Echo Park skateboard beard, migas farm-to-table Helvetica salvia. Cronut blog Truffaut, YOLO umami letterpress wayfarers church-key lo-fi. Ethical whatever banh mi tilde.
      p Cronut lomo migas, Bushwick leggings Neutra 3 wolf moon scenester Kickstarter raw denim lo-fi cred tousled photo booth Truffaut. Fashion axe pug quinoa biodiesel stumptown, dreamcatcher bespoke McSweeney's Thundercats crucifix fingerstache keytar chambray cold-pressed. Quinoa tote bag letterpress, kale chips salvia Etsy Truffaut normcore twee butcher chia irony. Keytar wolf scenester, mixtape master cleanse Blue Bottle lomo leggings polaroid Carles stumptown fixie occupy fingerstache cardigan. Gastropub narwhal cred yr. Vice Brooklyn PBR street art Thundercats, VHS typewriter XOXO banh mi mustache normcore asymmetrical salvia viral kitsch. Umami trust fund paleo lumbersexual, scenester Schlitz cold-pressed sartorial artisan Williamsburg migas.
      p Single-origin coffee gastropub kale chips leggings try-hard. Roof party Brooklyn fap, bicycle rights organic disrupt food truck. Cred mustache chillwave selvage Banksy. Slow-carb artisan skateboard Thundercats, next level Brooklyn fixie. Forage photo booth sustainable 3 wolf moon, quinoa Bushwick direct trade viral gentrify cronut listicle ethical. Post-ironic readymade sriracha, drinking vinegar aesthetic gastropub messenger bag. Retro Echo Park meditation, ennui Kickstarter paleo fashion axe. Hashtag cardigan scenester distillery Banksy, lumbersexual gastropub. Pickled tousled retro, umami food truck biodiesel Austin. Hoodie Truffaut four dollar toast banh mi, artisan master cleanse narwhal flexitarian. Bespoke direct trade Williamsburg umami, paleo Carles synth. Mlkshk bitters scenester, mumblecore direct trade narwhal hella sriracha cliche leggings twee paleo wayfarers. American Apparel locavore street art, actually Carles trust fund ethical. Beard meh organic, try-hard pickled sriracha +1 small batch narwhal hella cornhole chambray synth drinking vinegar.
      p Drinking vinegar quinoa fixie aesthetic organic, kale chips literally master cleanse Neutra Helvetica cardigan. Pickled brunch literally vegan viral 8-bit. Art party kogi gluten-free fingerstache, DIY pork belly put a bird on it hashtag 3 wolf moon tote bag chia. PBR&B Tumblr Austin, Odd Future XOXO vegan flexitarian keytar gastropub beard mumblecore skateboard lomo bespoke. Echo Park skateboard beard, migas farm-to-table Helvetica salvia. Cronut blog Truffaut, YOLO umami letterpress wayfarers church-key lo-fi. Ethical whatever banh mi tilde.
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open\+Sans:100,400,700')

black = #333
black30 = rgba(#000, 0.3)
black50 = rgba(#000, 0.5)
white90 = rgba(#fff, 0.9)

lightblue = #83b6c9
blue = #418eab
purple =  #7168b5

perspective = 1

pushBack(z)
  s = 1 + (z * -1) / perspective
  transform translateZ(unit(z, px)) scale(s)

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

html
  font-family 'Open Sans', helvetica, serif
  font-size 16px

body
  background white90

a
  display inline-block
  color white90
  text-decoration none
  
  &:hover
    background blue
h1
  color white90
  padding 4rem 0
  font-size 4rem
  font-weight 700
  letter-spacing .4rem
  text-align center  

h2
  padding 0 0 4rem
  font-size 4rem
  font-weight 700
  letter-spacing .4rem
  text-align center
  color white90
  text-shadow 1px 0 2px black30
  border-bottom 1px dotted black50

.parallax
  position relative
  perspective unit(perspective, px)
  perspective-origin 50% 100%
  width 100vw
  height 100vh
  overflow-x hidden
  overflow-y auto
    
.mountains
  position relative
  width 100vw
  height 100vh
  transform-style preserve-3d
  z-index -1

.peak, .logo
  position absolute
  top 0
  right 0
  bottom 0
  left 0
  transform-origin 50% 100%
  
  &.p0
    pushBack(-40)
  &.p1
    pushBack(-25)
  &.p2
    pushBack(-15)
  &.p3
    pushBack(-8)
  &.p4
    pushBack(-5)
  &.p5
    pushBack(-4)
  &.p6
    pushBack(-3)
  &.p7
    pushBack(-2)
  &.p8
    pushBack(-1)
  &.p9
    pushBack(-0.5)
        
  img
    position absolute
    width 110%
    height auto
    left -5%
    bottom -5%
  
.overlay
  position absolute
  width 100vw
  height 100vh
  left 0
  top 0
  background linear-gradient(purple 0%, blue 50%, lightblue 100%)
  opacity 0.7
  
.multiply
  opacity 1
  mix-blend-mode overlay
  
.logo
  pushBack(-2)
  
  h1
    font-size 10rem
    color black
    position absolute
    width 100vw
    bottom 25vw
    padding 0
    text-shadow 0 50px 20px black30

main
  position relative
  width 100vw
  padding 40px
  background lightblue
  z-index 2

article
  max-width 800px
  margin 0 auto

p
  color black50
  font-size 1.2rem
  max-width 800px
  line-height 1.6
  margin-bottom 20px
  text-align justify
              
            
!

JS

              
                // Safari Sniffing for the purpose of using mix-blend-mode
// Not default in chrome / funky in FF

(function() {
  function isSafari() {
    var userAgent = navigator.userAgent;
    return (/Safari/gi).test(userAgent) &&
      !(/Chrome/gi).test(userAgent);
  }
  if(isSafari()) {
    var overlay = document.querySelector('.overlay');
    overlay.classList.add('multiply');
  }
})();
              
            
!
999px

Console