Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <nav role='navigation' class="menu">
  <label for="menu">Menu <i class="fa fa-bars"></i></label>
  <input type="checkbox" id="menu">
  <ul>
    <li><a href="#">Home</a></li>
    <li class="menu-hasdropdown">
      <a href="#">About 
        <label title="toggle menu" for="about">
          <i class="fa fa-caret-down"></i>
        </label>
      </a>
      <input type="checkbox" id="about">
      <ul class="menu-dropdown">
        <li><a href="">History</a></li>
        <li><a href="">Mission</a></li>
        <li class="menu-hasdropdown menu-hasflyout">
          <a href="">Services
            <label title="toggle menu" for="services">
              <i class="fa fa-caret-down menu-downicon"></i>
              <i class="fa fa-caret-right menu-righticon"></i>
            </label>        
          </a>
          <input type="checkbox" id="services">
          <ul class="menu-dropdown">
            <li><a href="">Service 1</a></li>
            <li><a href="">Service 2</a></li>
            <li><a href="">Service 3</a></li>
          </ul>
        </li>
      </ul>
    </li>
    <li><a href="#">Clients</a></li>
    <li><a href="#">Contact Us</a></li>
  </ul>
</nav>


              
            
!

CSS

              
                /* vars */

$menu_background: #035e8d;
$menu_color: #e2e2e2;
$menu_breakpoint : 1024px;
$menu_toggle_background: black;
$menu_border: 1px solid rgba(255,255,255,0.1);
$menu_padding: 15px 20px;
$menu_icon_padding: 5px 10px;

/* hide show mixin */

@mixin show () {
  display: block;
  animation: grow .5s ease-in-out; // optional animation
}

@mixin hide () {
  display: none;
}

/* global  styles */

.menu {
  background: $menu_background;
}

.menu ul { 
  margin: 0; 
  padding: 0; 
  list-style: none; 
} 

.menu,
.menu a {
  color: $menu_color;
  text-decoration: none;
}

.menu a {
  display: block;
  white-space: nowrap; // prevent links form going to a new line
}

.menu-dropdown,
.menu input[type="checkbox"] { // hide defaults
  @include hide;
}

.menu label:hover {
  cursor: pointer;
}

/* narrow styles */

@media screen and (max-width: $menu_breakpoint) {
  // hide navigation and right icons
  .menu > ul,
  .menu-righticon {
    @include hide;
  }
  input[type="checkbox"]:checked + ul {
    @include show;
  }
}

/* large styles */

@media screen and (min-width: $menu_breakpoint + 1px) {
  // hide show navigation button and checkboxes
  .menu > label,
  input[type="checkbox"] {
    @include hide;
  }
  .menu a {
    padding: $menu_padding;
  }
  // align items and style them
  .menu > ul > li {
    display: inline-block;
  }
  // hover logics
  .menu-hasdropdown {
    position: relative;
    &:hover {
      > ul {
        @include show;
      }
    }
  }
  // dropdown position and style
  .menu-hasdropdown > ul {
    position: absolute;
    top:100%;
    left: 0;
    background: $menu_background;
  }
  // flyout position
  .menu-hasflyout > ul {
    left: 100%;
    top:0;
  }
  .menu-hasflyout .menu-downicon {
    @include hide;
  }
}





/* look and feel only, not needed for core menu*/

// optional animation for display none/block
@keyframes grow {
  0% {
    display: none;
    opacity: 0;
  }
  50% {
    display: block;
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

html { font-size: 100%; }
body {
  font-family: 'Roboto' sans-serif;
  line-height: 1.5;
}

.menu-dropdown a {
  padding: $menu_padding;
  border-bottom: $menu_border;
}

/* narrow  */
@media screen and (max-width: $menu_breakpoint) {
 .menu > label {
    background: $menu_toggle_background;
    display: block;
    padding: $menu_padding;
    text-align: right;
  }
  .menu a {
    padding: $menu_padding;
  }
  .menu > ul i {
    float: right;
    padding: $menu_icon_padding;
    background: darken($menu_background,15%);
  }
  .menu-dropdown  a {
    background: darken($menu_background,5%);
  }
  .menu-hasflyout > ul a {
    background: darken($menu_background,10%);
  }
}

@media screen and (min-width: $menu_breakpoint + 1px) {
  .menu {
    max-width: 1024px;
    margin: 0 auto;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console