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

              
                <nav id="navigation">
  <a data-scroll class="hov-color-red" href="#red">red</a>
  <a data-scroll class="hov-color-green" href="#green">green</a>
  <a data-scroll class="hov-color-blue" href="#blue">blue</a>
</nav>

<section id="red" class="wide">
  <h1>Red</h1>
</section>

<section id="green" class="wide">
  <h1>Green</h1>
</section>

<section id="blue" class="wide">
  <h1>Blue</h1>
</section>
              
            
!

CSS

              
                body {
  position: relative;
  padding: 0;
  margin: 0;
  font-family: 'Arial', sans-serif;
}
h1 {
  color: #fff;
  letter-spacing: 1px;
  font-size: 40px;
  width: auto;
}
nav {
 box-sizing: border-box;
 position: fixed;
 top: 0;
 left: 0;
 right: 0;
 padding: 20px 60px;
 text-align: center;
 background-color: #333;
 font-size: 18px;
 letter-spacing: 1px;
}
a {
  text-decoration: none;
  display: inline-block;
  text-align: center;
  text-transform: uppercase;
  color: #eee;
  padding: 1px 0;
  margin: 0 10px;
  transition: all 0.15s ease-in-out;
}

.hov-color-red:hover {
   color: #ff765a;
}
.hov-color-green:hover {
  color: #5aff8c;
}
.hov-color-blue:hover {
  color: #5acbff;
}

.wide {
  box-sizing: border-box;
  width: 100%;
  padding: 80px 60px 60px 60px;
  min-height: 100vh;
}
#red {
  background-color: #ff765a;
}
#green {
  background-color: #5aff8c;
}
#blue {
  background-color: #5acbff;
}

              
            
!

JS

              
                jQuery(document).ready(function($) {
  // Scroll to the desired section on click
  // Make sure to add the `data-scroll` attribute to your `<a>` tag.
  // Example: 
  // `<a data-scroll href="#my-section">My Section</a>` will scroll to an element with the id of 'my-section'.
  function scrollToSection(event) {
    event.preventDefault();
    var $section = $($(this).attr('href')); 
    $('html, body').animate({
      scrollTop: $section.offset().top
    }, 500);
  }
  $('[data-scroll]').on('click', scrollToSection);
}(jQuery));
              
            
!
999px

Console