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

              
                <section class="container">
  <h1>Demo: nth-child explained - Keyword</h1>

  <h2>Keyword - odd</h2>

  <ul class="nce nce1">
    <li>child element 1</li>
    <li>child element 2</li>
    <li>child element 3</li>
    <li>child element 4</li>
    <li>child element 5</li>
    <li>child element 6</li>
    <li>child element 7</li>
    <li>child element 8</li>
    <li>child element 9</li>
    <li>child element 10</li>
  </ul>

  <h2>Keyword - even</h2>

  <ul class="nce nce2">
    <li>child element 1</li>
    <li>child element 2</li>
    <li>child element 3</li>
    <li>child element 4</li>
    <li>child element 5</li>
    <li>child element 6</li>
    <li>child element 7</li>
    <li>child element 8</li>
    <li>child element 9</li>
    <li>child element 10</li>
  </ul>
  <a href="http://www.matt-harris.net/notes/nth-child-explained" class="h4">Back to the article</a>
</section>

<footer class="footer" role="contentinfo">
  <div class="container">

    <h4>Find me here</h4>

    <ul class="footer__social list--unstyled">
      <li class="footer__social-item">
        <a class="icon-social icon-social--twitter" href="https://twitter.com/matty_h"></a>
      </li>
      <li class="footer__social-item">
        <a class="icon-social icon-social--codepen" href="https://codepen.io/matt-harris/"></a>
      </li>
      <li class="footer__social-item">
        <a class="icon-social icon-social--github" href="https://github.com/matt-harris"></a>
      </li>
    </ul>

    <span class="footer__text">Built with <a href="https://www.outlinecss.co.uk">Outline</a></span>

    <span class="footer__text">Copyright © 2016 matt-harris.net | Stealing is naughty.</span>

  </div>
</footer>
              
            
!

CSS

              
                @import "compass/css3";

// variables
$color-primary: #39beef;
$color-secondary: #ea5375;
$color-tertiary: #187da4;
$color-white: #fff;
$color-grey: #ccc;
$font-primary: 'Open Sans', Arial, sans-serif;

// demo

.nce {
  list-style-type: none;
  margin: 1.2em 0;
  padding: 0;
  color: $color-white;
  
  li {
    margin-bottom: 0.5em;
    padding: .5em 1em;
    background-color: $color-primary;
  }
}

.nce1 li:nth-child(odd),
.nce2 li:nth-child(even) {
  background-color: $color-secondary;
}
              
            
!

JS

              
                // Demo: nth-child explained - Keyword
// http://www.matt-harris.net/notes/nth-child-explained
              
            
!
999px

Console