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

              
                <ul class="layout navigation">
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Link One</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Link Two</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Link Three</a>
  </li>
  <li class="layout__item--1 js-hidden--small">
    <a class="navigation__button navigation__button--default" href="#">Link Four</a>
  </li>
  <li class="layout__item--1 js-hidden--small">
    <a class="navigation__button navigation__button--default" href="#">Link Five</a>
  </li>
  <li class="layout__item--1 js-hidden--small">
    <a class="navigation__button navigation__button--default" href="#">Link Six</a>
  </li>
  <li class="layout__item--1 js-hidden--small">
    <a class="navigation__button navigation__button--default" href="#">Link Seven</a>
  </li>
  <li class="layout__item--1 js-hidden--small">
    <a class="navigation__button navigation__button--default" href="#">Link Eight</a>
  </li>
  <li class="layout__item--1 js-hidden--medium">
    <a class="navigation__button navigation__button--default" href="#">Link Nine</a>
  </li>
  <li class="layout__item--1 js-hidden--medium">
    <a class="navigation__button navigation__button--default" href="#">Link Ten</a>
  </li>
  <li class="layout__item--1 js-medium">
    <a class="navigation__button navigation__button--default" href="#">Link Eleven</a>
  </li>
  <li class="layout__item--1 js-hidden--large js-not-hidden hidden">
    <button class="navigation__button navigation__button--toggle js-navigation__button" data-text-swap="- Less" data-text-original="+ More">+ More</button>
  </li>
</ul>

<div class="container">
  <h1>Priority+ navigation with flexbox</h1>
  <p>Resize your screen to see it in action.</p>
  <p>Post from Alien Lebarge who penned the inspiration for this pen: <a href="http://www.alienlebarge.ch/2015/10/02/priority-plus-nav/">There's a blog post about this pen</a>.</p>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Roboto+Condensed);

html {
  font-family: 'Roboto Condensed', sans-serif;
}


/**
 * Box model
 */
html {
  box-sizing: border-box;
}

* {
  &,
  &:before,
  &:after {
    box-sizing: inherit;
  }
}

/**
 * Layout
 */

.layout {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.layout__item--1 {
  flex: 1 1 auto;
}

.layout__item--full {
  flex: 1 1 100%;
}

/**
 * Order
 */

.layout__item--order-1 { order: 1; }
.layout__item--order-2 { order: 2; }
.layout__item--order-3 { order: 3; }
.layout__item--order-4 { order: 4; }
.layout__item--order-5 { order: 5; }
.layout__item--order-last { order: 999; }

/**
 * Navigation GUI
 */
.navigation {
  /* reset list styles */
  margin: 0;
  padding: 0;
  list-style: none;
  
  width: 100%; 
}

.navigation__button {
  display: inline-block;
  width: 100%;
  height: 100%;
  padding: 1rem;
  
  text-decoration: none;
  text-align: center;
  
  border: 1px solid #fff; /* reset button style*/
}

.navigation__button--default {
  color: black;
  background-color: #35AA4E;
  &:hover {
    background-color: #2B8A31;
  }
}
  
.navigation__button--toggle {
  color: black;
  background-color: #72D387;
  &:hover {
    background-color: black;
    color:white;
  }
}

.navigation__button--important {
  color: #fff;
  background-color: #FF1038;
  &:hover {
    background-color: #ff4d38;
  }
}

.navigation__button--info {
  color: #fff;
  background-color: #2972F3;
  &:hover {
    background-color: #60A5EA;
  }
}

/**
 * Hide things
 */
@media screen and (max-width: 44.9375em) {
  .hidden--small {
    display: none !important;
    visibility: hidden !important;
  }
}

@media screen and (max-width: 63.9375em) {
  .hidden--medium {
    display: none !important;
    visibility: hidden !important;
  }
}
@media screen and (min-width: 64em) {
  .hidden--large {
    display: none !important;
    visibility: hidden !important;
  } 
}

.hidden {
  display: none !important;
  visibility: hidden !important;
}


/************
 * Everything down there is only for presentation
 ************/

/**
 * Container
 */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem;
}

/**
 * Code
 */
code {
  background-color: #eaeaea;
}

/**
 * Links
 */
a {
  color: #000;
}
              
            
!

JS

              
                /**
 * The javascript is build in an enhancement manner.
 * If javascript isn't available, all menu items will be shown.
 */
$(document).ready(function() {
  
  // hide items depending on the viewport
  $(".js-hidden--small").addClass("hidden--small");
  $(".js-hidden--medium").addClass("hidden--medium");
  $(".js-hidden--large").addClass("hidden--large");
  // remove the hidden (everywhere) class
  $(".js-not-hidden").removeClass( "hidden" );
  
  // Toggle
  $(".js-navigation__button").on("click", function() {
    
    // Toggle text
    var el = $(this);
    el.text() == el.data("text-swap") ? el.text(el.data("text-original")) : el.text(el.data("text-swap"));

    // Show/unshow hidden menu
    $(".js-hidden--small").toggleClass("hidden--small");
    $(".js-hidden--medium").toggleClass("hidden--medium");
  });

});
              
            
!
999px

Console