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

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 class="main-nav" role="navigation">
  <ul class="menu">
    <li class="active"><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Bio</a></li>
    <li class="menu-item-has-children"><a href="#">Projects</a>
      <ul class="sub-menu">
        <li><a href="1">Art Projects</a></li>
        <li><a href="2">Photo</a></li>
        <li class="menu-item-has-children"><a href="3">Web Development</a>
            <ul class="sub-menu">
                <li><a href="4">Vanilla</a></li>
                <li><a href="5">Chocolate</a></li>
                <li><a href="6">Swirl Sukka</a></li>
            </ul>
        </li>
      </ul>
    </li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>

<section class="info">
  <p>A bare bones nav menu that is semantic and accessible.</p>
</section>
              
            
!

CSS

              
                @import "compass/css3";

//demo
.info {
  display:block;
  clear:both;
  padding:3em 0;
  margin-top:2em;
  p {
    font:2em "Helvetica Neue";
    color:#777;
    width:80%;
    margin:0 auto;
  }
}


a {
  text-decoration:none;
  font-family:'Helvetica Neue';
  color:#222;
  font-weight:400;
  -webkit-font-smoothing:antialiased;
}

.main-nav {
  display:block;
  float:left; //just for clearing
  width:100%;
  position: relative;
  //background-color:whitesmoke;
  -webkit-box-shadow:0 1px 5px rgba(0,0,0,.25);
          box-shadow:0 1px 5px rgba(0,0,0,.25);
  .menu {
    float: left; //just for clearing
    //ul
    li {
      float:left;
      position: relative;
      &.menu-item-has-children {
        > a {
          &:after {
            content: "▸";
            position: relative;
            margin-left:0.25em;
            display:inline-block;
           -moz-transform: scale(1) rotate(0deg);
        -webkit-transform: scale(1) rotate(0deg);
             -o-transform: scale(1) rotate(0deg);
            -ms-transform: scale(1) rotate(0deg);
                transform: scale(1) rotate(0deg);
            //transition:transform 100ms ease-in-out;
          }
        }//a
        &:hover > a:after {
            -moz-transform: scale(1) rotate(90deg);
            -webkit-transform: scale(1) rotate(90deg);
            -o-transform: scale(1) rotate(90deg);
            -ms-transform: scale(1) rotate(90deg);
            transform: scale(1) rotate(90deg);
          }
      }//has-children
      a {
        display: block;
        padding:1em 2em;
        text-align:center;
        //transition:all 100ms ease-in-out;
      }
      &.active a {
        background-color:#333;
        color:#fff;
      }
      & > a:hover {
        background-color:#777;
        color:#fff;
      }
      .sub-menu {
        position: absolute;
        left:0;
        top: 100%;
           -moz-transform: scale(0);
        -webkit-transform: scale(0);
             -o-transform: scale(0);
            -ms-transform: scale(0);
                transform: scale(0);
        //transform-origin: top left;
        //transition:all 200ms ease-in;
        li {
          display:block;
          float:none;
          margin-bottom:1px;
          a {
            text-align:left;
            white-space: nowrap;
            //transition:all 200ms ease-in-out;
            &:hover {
              background-color:#ccc;
            }
          }//a
          &:first-child > a{
            border-top:2px solid rgba(0,0,0,0.05);
          }
        }//li
      }//sub-menu
      &:hover > .sub-menu, 
      &.menu-item-has-children a:focus + .sub-menu,
      .sub-menu.active
      {
        -moz-transform: scale(1);
     -webkit-transform: scale(1);
          -o-transform: scale(1);
         -ms-transform: scale(1);
             transform: scale(1);
        a {
          background-color:#eee;
        }
        .sub-menu { // sub sub-menu
          top:0;
          left:100%;
          margin-left:1px;
          li {
            a {
              border-top:0;
            }
          }
        }
      }
    }//li
  }//menu
}//main-nav
              
            
!

JS

              
                
              
            
!
999px

Console