123

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <ul class="layout navigation">
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Vie privée</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Formation</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Economie</a>
  </li>
  <li class="layout__item--1 js-hidden--palm">
    <a class="navigation__button navigation__button--default" href="#">Santé</a>
  </li>
  <li class="layout__item--1 js-hidden--palm">
    <a class="navigation__button navigation__button--default" href="#">Social</a>
  </li>
  <li class="layout__item--1 js-hidden--palm">
    <a class="navigation__button navigation__button--default" href="#">Culture</a>
  </li>
  <li class="layout__item--1 js-hidden--palm">
    <a class="navigation__button navigation__button--default" href="#">Sécurité</a>
  </li>
  <li class="layout__item--1 js-hidden--palm">
    <a class="navigation__button navigation__button--default" href="#">Mobilité</a>
  </li>
  <li class="layout__item--1 js-hidden--portable">
    <a class="navigation__button navigation__button--default" href="#">Environnement</a>
  </li>
  <li class="layout__item--1 js-hidden--portable">
    <a class="navigation__button navigation__button--default" href="#">Territoire</a>
  </li>
  <li class="layout__item--1 js-hidden--portable">
    <a class="navigation__button navigation__button--default" href="#">Etat, Droit, Finances</a>
  </li>
  <li class="layout__item--1 js-hidden--desk 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><a href="http://www.alienlebarge.ch/2015/10/02/priority-plus-nav/">There's a blog post about this pen</a>.</p>
  <h2>How it works</h2>
  <p>The <code>li</code> with the class <code>.js-hidden--palm</code> are hidden on palm and the ones with <code>.js-hidden--portable</code> on ... portable.</p>
  <p>If the javascript isn't available, all menu items are shown.</p>
  <h2>Bigger toggle button</h2>
  <p>To have a bigger toggle button, replace the <code>.layout__item--1</code> class with <code>.layout__item--full</code>. The menu will always have a minimum height of two lines.</p>
  <p>It will give you something like that:</p>
</div>
<ul class="layout navigation">
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">The toggle</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">button</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">is always</a>
  </li>
    <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">100% width</a>
  </li>
  <li class="layout__item--full">
    <button class="navigation__button navigation__button--toggle">More (not working)</button>
  </li>
</ul>

<div class="container">
  <h2>Moar style</h2>
  <p>You can easily add more button style. Just create a new class.</p>
</div>

<ul class="layout navigation">
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">Kawabonga !</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">It</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">looks</a>
  </li>
    <li class="layout__item--1">
    <a class="navigation__button navigation__button--important" href="#">important</a>
  </li>
    </li>
    <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">and</a>
  </li>
  </li>
    <li class="layout__item--1">
    <a class="navigation__button navigation__button--info" href="#">informative</a>
  </li>
  <li class="layout__item--1 hidden--desk">
    <button class="navigation__button navigation__button--toggle">More (not working)</button>
  </li>
</ul>

<div class="container">
  <h2>Another kind of priority</h2>
  <p>It's possible to choose wich menu item are available at wich viewport size. Imagine if you have a login button on the right that must be present at all viewport sizes.</p>
  <p>Be carrefull with that. This is not necessarily the best thing to do in terms of UX.</p>
  <p><strong>Resize your browser window</strong> to see that in action in the following exemple:</p>
</div>

<ul class="layout navigation">
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">item 1</a>
  </li>
  <li class="layout__item--1 hidden--palm">
    <a class="navigation__button navigation__button--info" href="#">item 2</a>
  </li>
  <li class="layout__item--1 hidden--portable">
    <a class="navigation__button navigation__button--important" href="#">item 3</a>
  </li>
  <li class="layout__item--1 hidden--palm">
    <a class="navigation__button navigation__button--info" href="#">item 4</a>
  </li>
  <li class="layout__item--1 hidden--portable">
    <a class="navigation__button navigation__button--important" href="#">item 5</a>
  </li>
  <li class="layout__item--1">
    <a class="navigation__button navigation__button--default" href="#">item 6</a>
  </li>
  <li class="layout__item--1 hidden--desk">
    <button class="navigation__button navigation__button--toggle">More (not working)</button>
  </li>
</ul>

<div class="container">
  <h2>Ordering crazyness</h2>
  <p>It's flexbox. So you can imagine reordering the menu items. (And why not having a specific order depending of the viewport.)</p>
  <p>Be carefull with that, it may not be UX-friendly.</p>
</div>

<ul class="layout navigation">
  <li class="layout__item--1 layout__item--order-5">
    <a class="navigation__button navigation__button--default" href="#">item 1</a>
  </li>
  <li class="layout__item--1 layout__item--order-2">
    <a class="navigation__button navigation__button--default" href="#">item 2</a>
  </li>
  <li class="layout__item--1 layout__item--order-4">
    <a class="navigation__button navigation__button--default" href="#">item 3</a>
  </li>
  <li class="layout__item--1 layout__item--order-1">
    <a class="navigation__button navigation__button--default" href="#">item 4</a>
  </li>
  <li class="layout__item--1 layout__item--order-3">
    <a class="navigation__button navigation__button--default" href="#">item 5</a>
  </li>
  <li class="layout__item--1 hidden--desk layout__item--order-last">
    <button class="navigation__button navigation__button--toggle">More (not working)</button>
  </li>
</ul>
            
          
!
            
              @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: purple;
  background-color: #F8B8E6;
  &:hover {
    background-color: #DD4E8D;
  }
}
  
.navigation__button--toggle {
  color: purple;
  background-color: #E1C1FC;
  &:hover {
    background-color: #DBBBF4;
  }
}

.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--palm {
    display: none !important;
    visibility: hidden !important;
  }
}
@media screen and (min-width: 45em) {
  .hidden--lap-and-up {
    display: none !important;
    visibility: hidden !important;
  }
}
@media screen and (max-width: 63.9375em) {
  .hidden--portable {
    display: none !important;
    visibility: hidden !important;
  }
}
@media screen and (min-width: 64em) {
  .hidden--desk {
    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;
}
            
          
!
            
              /**
 * 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--palm").addClass("hidden--palm");
  $(".js-hidden--portable").addClass("hidden--portable");
  $(".js-hidden--desk").addClass("hidden--desk");
  // 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--palm").toggleClass("hidden--palm");
    $(".js-hidden--portable").toggleClass("hidden--portable");
  });

});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console