Pen Settings



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


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


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.


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.


                <nav class="nav">
  <a href="#col1" class="active">First</a>
  <a href="#col2">Second</a>
  <a href="#col3">Third</a>
<div class="content-wrapper">
  <div class="content">
    <div id="col1">
      <h2>First Title</h2>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p>
    <div id="col2">
      <h2>Second Title</h2>
      <p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</p>
    <div id="col3">
      <h2>Third Title</h2>
      <p>Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.</p>


.content {
  display: flex;
.nav a,
.content > div {
  box-sizing: border-box;
  padding: 0 2%;
  width: 33.33%;

@media screen and (max-width: 39.99em) {
  .nav a {
    border-bottom: 2px solid gray;
    color: black;
    display: inline-block;
    padding: 1em;
    text-align: center;
  .nav {
    border-bottom: 5px solid gray;
    font-weight: bold;
  .content-wrapper {
    width: 100%;
    overflow: hidden;
  .content {
    padding: 0.5em 0;
    width: 300%;

@media screen and (min-width: 40em) {
  .nav {
    display: none;


                function setActive(event) {
  if ( !== 'A') {
    return false;

function addActiveClass(link) {
  var activeLink = document.getElementsByClassName('active');
  if (activeLink.length) {
    activeLink[0].className = '';
  link.className = 'active';

window.onload = function () {    
  var nav = document.getElementsByClassName('nav');
  nav[0].addEventListener('click', setActive);