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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div class="panel">
  <h1>Asdfgh</h1>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
</div>

<div class="panel">
  <h1>Asdfgh</h1>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
</div>

<div class="panel">
  <h1>Asdfgh</h1>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
</div>

<div class="panel">
  <h1>Asdfgh</h1>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam venenatis orci quis massa consequat consequat. Vestibulum vel velit vitae justo mattis tempus sed id ex. Donec tempus bibendum dolor nec bibendum. Suspendisse potenti. Suspendisse diam mauris, consequat non nulla id, tempor ultricies mi. Proin ullamcorper tortor sit amet quam interdum elementum. Sed convallis urna in faucibus pretium.</p>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Coustard);

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

body {
  background: url(http://www.noupe.com/wp-content/uploads/2009/10/pattern-13.jpg) repeat fixed;
  font-size: 16px;
  font-family: Coustard;
}

.panel {
  background: rgba(255,255,255,.5);
  color: white;
  max-width: 800px;
  margin: 80px auto;
  padding: 40px;
}

h1 {
  font-size: 3em;
  margin: 20px 0;
}

p {
  font-size: 1.25em; 
  line-height: 1.2em;
  margin-bottom: 20px;
}
              
            
!

JS

              
                $(window).on('scroll', function(){
  var curPos = $(window).scrollTop();
  $('body').css('background-position', '0 -' + curPos * .1 + 'px');
  fadePanels(curPos);
}).scroll();

function fadePanels(curPos) {
  var panels = $('.panel');
  
  for (var i = 0; i < panels.length; i++) {
    var offsetTop = $(panels[i]).offset().top;
    var halfPanel = (($(panels[i]).height() + 80) / 2) // half the panel height + padding
    var offsetHalf = halfPanel + offsetTop;
 
    $(panels[i]).attr('data-scroll-top' , offsetTop);
    $(panels[i]).attr('data-scroll-half', offsetHalf);
   
    var j = (curPos - offsetHalf) / halfPanel;
    
    if (curPos > $(panels[i]).data('scroll-half')) {
      $(panels[i]).css('opacity', 1 - (j));
    } else {
      $(panels[i]).css('opacity', '1');
    }
  }
}
              
            
!
999px

Console