cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <header class="header">
<nav>
<ul class="nav">
  <li class="level1 has_children"><a href="#">Cool stuff</a>
    <ul class="nav">
      <li class="level2"><a href="#">Stuff</a></li>
      <li class="level2"><a href="#">More stuff</a></li>
      <li class="level2"><a href="#">A little less stuff</a></li>
      <li class="level2"><a href="#">A little more action</a></li>
      <li class="level2"><a href="#">And rest</a></li>
    </ul>
</li>
  <li class="level1 has_children"><a href="#">Hot Stuff</a>
    <ul class="nav">
      <li class="level2"><a href="#">Stuff</a></li>
      <li class="level2"><a href="#">More stuff</a></li>
      <li class="level2"><a href="#">A little less stuff</a></li>
      <li class="level2"><a href="#">A little more action</a></li>
      <li class="level2"><a href="#">And rest</a></li>
    </ul>
</li>
  <li class="level1 has_children"><a href="#">Other Stuff</a>
    <ul class="nav">
      <li class="level2"><a href="#">Stuff</a></li>
      <li class="level2"><a href="#">More stuff</a></li>
      <li class="level2"><a href="#">A little less stuff</a></li>
    </ul>
</li>
</ul>
</nav>
</header>
            
          
!
            
              @import "compass/css3";

$main: #363636;
$brand-color: #FF3F5E;
$base-spacing-unit: 22px;
.header{
  border-top: 2px solid $brand-color;
  background: $main;
  float: left;
  width: 100%;
}
.nav{
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
  font-size: 1.3rem;
}
li{
  &:hover,
  &:focus{
    background: darken($main, 10%);
  }
  
  a{
  text-decoration: none; 
  display: block;
  color: #fff;
  padding: $base-spacing-unit / 2;
  text-decoration: none;
  }
}

.level1{
  width: 33.333%;
  float: left;
  text-transform: uppercase;
}
.level2{
  text-transform: none;
}


.has_children{
  position: relative;
  /* set the flyout to be collapsed height and invisible as you can't animate display states */
  ul{
    visibility: hidden;
    max-height: 0;
    height: auto;
    position: absolute;
    left: 0;
    opacity: 0;
    width: 100%;
    background: inherit;
    list-style: none;
    background: darken($main, 10%);
  }
  a{
    display: block;
    &:hover,
    &:focus {
      background: darken($main, 15%);
    }
  }
  /* top level only = yellow arrow */
  > a{
     &:after{
      display: inline-block;
      margin-left: $base-spacing-unit;
      content: "";
      vertical-align: middle;
      border-top: 0.5rem solid $brand-color;
      border-left: 0.5rem solid transparent;
      border-right: 0.5rem solid transparent;
    }
  }
  /* on hover/focus fade in the auto height on the <ul> */
  &:hover ul,
  &:focus ul{
    visibility: visible;
    opacity: 1;
    max-height: 500px; /* a number bigger than it will ever be */
    transition: .4s ease .25s;
    /* codepen seems to need this on the <li> element as well, iframe issue maybe? */
    li {
      visibility: visible;
    }
  }
}
    
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console