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

              
                <nav>
  <ul>
    <li><a val="#About">About</a></li>
    <li><a val="#Services">Services</a></li>
    <li><a val="#Contact">Contact</a></li>
  </ul>
</nav>

<container>
<div id="About">
<h2>About</h2> 
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis suscipit lorem sapien, nec condimentum magna consequat sed. Nunc mattis, orci eu elementum posuere, diam elit consequat felis, at egestas nisi tortor hendrerit enim. Curabitur sed elit non erat porttitor cursus vel vel massa. In at neque aliquam, tristique odio in, porta quam. Proin eu metus erat. Quisque varius dapibus bibendum. Nam quis sapien libero. Aenean ex nisi, pharetra id tellus in, ullamcorper fermentum est. Nulla gravida ultrices bibendum. Donec eu ullamcorper eros. Integer ut vulputate risus.</p>
</div>
<div id="Services">
<h2>Services</h2> 
<p>Nam sed vulputate sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse eu convallis sem. Quisque vel nibh lacinia nulla mattis rhoncus sit amet nec purus. Pellentesque bibendum fringilla posuere. Praesent sollicitudin sodales lectus. Quisque vitae diam massa. In ultricies accumsan vestibulum. Morbi sed metus sed magna euismod cursus. Nullam efficitur quam sapien, id ornare orci dapibus vitae. Pellentesque sagittis dui tincidunt purus consectetur volutpat. Pellentesque accumsan efficitur orci, dapibus hendrerit mi sagittis et. In pretium vitae dolor malesuada venenatis. Donec elementum, enim vel convallis rhoncus, diam lacus consequat dui, sed luctus quam elit a odio.</p>
</div>
<div id="Contact">
<h2>Contact</h2> 
<p>Fusce facilisis vitae enim non tempor. Cras fringilla, eros in cursus imperdiet, metus sem luctus ipsum, eget placerat ex mauris quis lectus. Quisque posuere lacus vel tempor vulputate. Integer bibendum, velit a ornare vestibulum, turpis mauris egestas purus, molestie laoreet ex eros quis tellus. Suspendisse ultrices quis eros sed blandit. Nulla ac pharetra neque. Etiam ultricies nibh et mauris eleifend blandit. Vestibulum pharetra magna et enim eleifend, aliquam blandit nunc pretium. Sed scelerisque lorem in velit scelerisque, sit amet viverra tortor commodo. Quisque aliquet arcu eget commodo dapibus. Fusce lorem justo, ultrices eget magna in, volutpat convallis dui. Nulla sit amet euismod erat. Maecenas ac turpis ac mauris ultrices lacinia sed at massa. Praesent varius quam nec mauris pulvinar, nec euismod lectus dapibus. Duis quis diam ornare, lacinia dolor et, mattis ligula. Donec sit amet dolor vitae nulla euismod lobortis sed sit amet libero.</p>
</div>
  </container>
              
            
!

CSS

              
                container {
  border: solid 1px black;
  display:block;
  max-width: 400px;
  padding: 30px;
}
              
            
!

JS

              
                $(function(){
  $('nav a').each(function(){
    var thisAnchor = $(this).attr('val');
    $(this).click(function(){
      $('html, body').animate({
         scrollTop: ($(thisAnchor).offset().top)
      },500);
    });             
  });
});
              
            
!
999px

Console