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>
  
  <a href="#" class="profile icon-user"></a>
  <a href="#" class="logo">logo</a>
  <a href="#" class="search icon-search"></a>
  
  <div class="main-nav">
    <ul>
      <li><a href="#">longform</a></li>
      <li><a href="#">reviews</a></li>
      <li><a href="#">videos</a></li>
      <li><a href="#">tech</a></li>
      <li><a href="#">science</a></li>
      <li><a href="#">entertainment</a></li>
      <li><a href="#">cars</a></li>
      <li><a href="#">design</a></li>
    </ul>
  </div>
  <div class="fade"></div>
  
</nav>
              
            
!

CSS

              
                //Import icons
@import url('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css');
//Media query to switch modes
@mixin large {
  @media (min-width: 800px) {
    @content;
  }
}

//Responsive typography (optional)
html {
  font-size: 16px;
  @include large {
    font-size: 18px;
  }
}

body {
  font-family: -apple-system, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  width: 100%;
  color: white;
}

a {
  transition: opacity 150ms ease;
  text-decoration: none;
  color: inherit;
  &:hover {
    opacity: .75;
  }
}

nav {
  position: relative;
  display: flex;
  width: 100%;
  background: grey;
  flex-flow: row wrap;
  justify-content: space-between;
  @include large {
    flex-flow: row nowrap;
  }
}

.logo {
  margin: .5rem;
  text-transform: uppercase;
  color: lightGray;
  flex: 0 1 auto;
  order: 2;
  //Move to 1st position and add space on larger devices
  @include large {
    margin-right: 1rem;
    order: 1;
  }
}

.profile {
  font-size: 1.4rem;
  line-height: 1.5rem;
  padding: .5rem;
  //Non-essential, just OCD
  transform: translateY(.05rem);
  flex: 0 1 auto;
  order: 1;
  //Move to 3rd position on larger devices
  @include large {
    order: 3;
  }
}

.search {
  font-size: 1.2rem;
  line-height: 1.5rem;
  padding: .5rem;
  flex: 0 1 auto;
  order: 3;
  //Move to 4th position on larger devices
  @include large {
    order: 4;
  }
}

.main-nav {
  overflow-x: scroll;
  padding-right: 1rem;
  white-space: nowrap;
  flex: 1 1 100%;
  order: 4;
  -webkit-overflow-scrolling: touch;
  //Move main navigation to 2nd position or larger devices
  @include large {
    order: 2;
  }
  //Allow horizontal scrolling on smaller screens
  li {
    display: inline-block;
    padding: .5rem;
    text-transform: capitalize;
  }
  li:last-child {
    margin-right: 2rem;
  }
}

//Add visual cue indicating that there is more content
.fade {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 5rem;
  height: 2rem;
  background: linear-gradient( 90deg, rgba(grey, 0), grey);
  @include large {
    display: none;
  }
  pointer-events: none;
}
              
            
!

JS

              
                
              
            
!
999px

Console