octocatstartv

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.

            
              
<div class="wrapper">
  <nav role='navigation'>
    <ul class="level-top">
      <li><a href="#">Home</a></li>
      <li class="has-children"><a href="#">About</a>
        <ul class="level-2">
          <li><a href="#">Item 1</a></li>
          <li><a href="#">Item 2</a></li>
        </ul>    
      </li>
      <li class="has-children"><a href="#">Clients</a>      
        <ul class="level-2"> 
          <li><a href="#">Item 1</a></li>
          <li><a href="#">Item 2</a></li>
          <li class="has-children"><a href="#">Item 3</a>
            <ul class="level-3">
              <li><a href="#">Item 3.1</a></li>
              <li><a href="#">Item 3.2</a></li>
              <li><a href="#">Item 3.3</a></li>
              <li><a href="#">Item 3.4</a></li>
            </ul>  
          </li>
          <li><a href="#">Item 4</a></li>
        </ul>  
      </li>
      <li><a href="#">Contact Us</a></li>
    </ul>
  </nav> 
  
  <div class="content">
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>  
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> 

  </div>
</div>
            
          
!
            
              * {
  box-sizing:border-box;
}

.wrapper {
  margin:25px;
  background:AntiqueWhite ;
}

a {
  text-decoration:none;
  display:block;
  color:grey;
}

a:hover {
  color:white;
}

nav {
float:left;
}

/* TOP LEVEL STUFF */

.level-top {
  width:200px;
}

li {
  background: #292929;  
  border-top:1px solid black;
  border-right: 1px solid #3c3c3c;
  border-left: 1px solid #3c3c3c;
  position:relative;
}

li:last-child {
  border-bottom:1px solid black;
}

.has-children {
  /* no styles but this class would be probably be added via javascript */
}

.has-children:after {
  /* Adds sub-menu indicator */
  content:"";
  border-right:.5em solid transparent;
  border-left:.5em solid NavajoWhite;
  border-top:.5em solid transparent;
  border-bottom:.5em solid transparent;
  position:absolute;
  top:.5em;
  right:0;
  opacity:0.5;
}

.has-children:hover:after{
  border-left:.5em solid white;
  opacity:1;
}

/* LEVEL ONE/TWO/THREE STUFF */

.level-top > li > a,
.level-2 > li > a,
.level-3 > li > a {  
  padding-left:10px;
  font-size:16px;
  line-height:2em;
}

.level-2,
.level-3 {
  /* HIDES SUN-MENU UNTIL NEEDED */
  display:none;
}

.level-top li:hover .level-2,
.level-2 li:hover .level-3 {
  /* SHOWS SUB MENUES WHEN REQUIRED*/ 
  position:absolute;
  width:100%;
  display:block;
}

.level-2 > li,
.level-3 > li{
  /* POSITIONS SUB MENU LIST ITEMS */
  left:100%;
  top:-33px; /* = 16px + 16px (padding/line-height) +1px border */
}

.content {
  float:left;
  padding:10px;
  margin:10px;
  background:lightgrey;
}

.content p {
  padding: 1em 0;


            
          
!
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