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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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>
  <p>Scroll to Demo</p>
  <span>&#8691;</span>
</header>

<h1 class="shadow" data-shadow="text">Shadow <span>Parallax</span></h1>
  
<p class="shadow" data-shadow="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc id arcu est, nec tempus turpis. Curabitur pulvinar luctus enim a molestie. Integer aliquam tincidunt adipiscing.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus facilisis, ante at ultricies interdum, sapien lectus laoreet arcu, ut placerat nibh diam eu metus. Vivamus rutrum facilisis enim, ac pretium odio ultricies vitae. Sed vitae ultrices dui.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Sed pellentesque adipiscing tempor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eros augue, pharetra ac suscipit et, mattis ut nisi. Ut id convallis lorem. In pharetra tempus ligula sit amet rutrum. Suspendisse facilisis est vel augue sagittis a lacinia nibh posuere.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus facilisis, ante at ultricies interdum, sapien lectus laoreet arcu, ut placerat nibh diam eu metus. Vivamus rutrum facilisis enim, ac pretium odio ultricies vitae. Sed vitae ultrices dui.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Sed pellentesque adipiscing tempor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eros augue, pharetra ac suscipit et, mattis ut nisi. Ut id convallis lorem. In pharetra tempus ligula sit amet rutrum. Suspendisse facilisis est vel augue sagittis a lacinia nibh posuere.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus facilisis, ante at ultricies interdum, sapien lectus laoreet arcu, ut placerat nibh diam eu metus. Vivamus rutrum facilisis enim, ac pretium odio ultricies vitae. Sed vitae ultrices dui.</p>

<h2 class="shadow" data-shadow="box">Lorem ipsum</h2>

<p class="shadow" data-shadow="text">Sed pellentesque adipiscing tempor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eros augue, pharetra ac suscipit et, mattis ut nisi. Ut id convallis lorem. In pharetra tempus ligula sit amet rutrum. Suspendisse facilisis est vel augue sagittis a lacinia nibh posuere.</p>
              
            
!

CSS

              
                @import url( https://fonts.googleapis.com/css?family=Raleway:200,600 );

html {
  background: #eee;
}

body {
  width: 400px;
  margin: 40px auto;
  color: #222;
  font-family: 'Raleway', sans-serif;
  font-weight: 200;
  line-height: 1.6em;
}

header {
  margin: 100px 0 200px;
  color: #ddd;
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 0 #fff;
}

header p {
  margin-bottom: 2em;
}

header span {
  position: relative;
  font-size: 100px;
  font-weight: 200;
  -webkit-animation: bounce 1s infinite ease;
  -moz-animation: bounce 1s infinite ease;
  -o-animation: bounce 1s infinite ease;
  animation: bounce 1s infinite ease;
}

.shadow[data-shadow=text] {
  text-shadow: 0 3px 10px rgba(0,0,0,0.95);
}

.shadow[data-shadow=box] {
  box-shadow: 0 3px 20px -5px rgba(0,0,0,0.95);
}

h1 {
  color: #4466dd;
  font-size: 87px;
  font-weight: 200;
  line-height: 1em;
  text-align: left;
  text-transform: uppercase;
}

h1 span {
  font-size: 76px;
}

h2 {
  margin: 1em 0;
  color: #eee;
  font-size: 50px;
  font-weight: 200;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.3em;
  background: #4466dd;
}

p { margin: 20px 0; }


/* Bounce */

@-webkit-keyframes bounce {
  0%, 100%   { top: 0; }
  50%   { top: 20px; }
}

@-moz-keyframes bounce {
  0%, 100%   { top: 0; }
  50%   { top: 20px; }
}

@-o-keyframes bounce {
  0%, 100%   { top: 0; }
  50%   { top: 20px; }
}

@keyframes bounce {
  0%, 100%   { top: 0; }
  50%   { top: 20px; }
}
              
            
!

JS

              
                var shadow = $('.shadow'),
    win = $(window);

function set3D() {
  var windowHeight = win.height();
  
	shadow.each(function() {
		var self = $(this),
        scrollHeight = win.scrollTop(),
        elementPosition = self.position(),
        shadowType = self.data('shadow') + 'Shadow',
        shadowOffset = (elementPosition.top + self.height() / 2 - scrollHeight) / windowHeight * -100 + 50;
		
    if (shadowType === 'textShadow') {
      self.css(shadowType, '0 ' + shadowOffset / 3 + 'px 10px rgba(0,0,0,0.15)');
    }
    else {
      self.css(shadowType, '0 ' + shadowOffset / 3 + 'px 20px -5px rgba(0,0,0,0.15)');
    };
  });
};
	
win.on('load scroll resize', function() {
	set3D();
});
              
            
!
999px

Console