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

              
                
<html>

<body>
  
  <h1>Simple CSS Menu</h1>
  <p>clean standard horizontal drop down menu, in plain SCSS & WordPress ready.</p>
  
<nav class="navbar" role='navigation'>
    
  <ul class="menu no-js">
    <li class="menu-item"><a href="#" class="active">Menu Item</a></li>
    <li class="menu-item"><a href="#">Sub Menu</a>
      <ul class="sub-menu">
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item">
            <a href="#">Menu Item</a>
            <ul class="sub-menu">
              <li class="menu-item"><a href="#">Menu Item</a></li>
              <li class="menu-item"><a href="#">Menu Item</a></li>
              <li class="menu-item"><a href="#">Menu Item</a></li>
              <li class="menu-item"><a href="#">Menu Item</a></li>
              <li class="menu-item"><a href="#">Menu Item</a>
                <ul class="sub-menu">
                  <li class="menu-item"><a href="#">Menu Item</a></li>
                  <li class="menu-item"><a href="#">Menu Item</a></li>
                  <li class="menu-item"><a href="#">Menu Item</a></li>
                  <li class="menu-item"><a href="#">Menu Item</a></li>
                </ul>  
              </li>
              <li class="menu-item"><a href="#">Menu Item</a></li>
              <li class="menu-item"><a href="#">Menu Item</a></li>
            </ul>
        </li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
      </ul>
    </li>

     <li class="menu-item"><a href="#">Menu Item</a> 
      <ul class="sub-menu">
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
        <li class="menu-item"><a href="#">Menu Item</a></li>
      </ul>  
    </li>

     <li class="menu-item"><a href="#">Menu Item</a></li>

  </ul>
</nav>  

</body>

</html>
              
            
!

CSS

              
                /* setup */
* {
  -webkit-box-sizing:border-box;
  -moz-box-sizing:border-box;
  box-sizing:border-box;
  transition:all 60ms ease;
}

/* variables */
$menuHeight      : 3rem;
$subHeight       : 2rem;
$subwidth        : 180px;
$subPadding      : 0.35rem 0.25rem 0.25rem;
$suboffset       : 0.35rem; // offset the top padding


@mixin cf() {
  *zoom: 1;
	&:before, &:after {
		content: " ";
		display: table;
	}
	&:after { 
	 clear: both;
	}
}

%blockRel {
  display:block;
  position: relative;
}

%inBlockRel {
  display:inline-block;
  position: relative;
}


/* 
Essential Styles 
- - - - - - - - - - - -
I like to keep the specificity low by using tags to make it easy to override the basic strucuture, if needed.  Adding an id to the root element would offer more isolation.

*/


.menu {
  postion:relative;
  list-style:none;
  float:left;
  padding:0;
  margin:0;
  
  
  li {
    @extend %inBlockRel;
    float: left;
  }
  a {
      @extend %inBlockRel;
      height:$menuHeight;
      line-height:$menuHeight;
      width:100%;
    }
  
  ul { // drop down menu
    display: none;
    position: absolute;
    top: 100%;
    left : 0px;
    width: $subwidth;
    min-width:$subwidth;
    padding: 0;
    margin:0;
    
    ul { // nested drops
      top: (0 - $suboffset); 
      left: 100%;
    }
    
    li {
      @extend %blockRel;
      float: left;
      width:100%;
    }
    
    a {
      @extend %blockRel;
      height: $subHeight;
      line-height: $subHeight;
    }
    
  }
  
  li:hover > .sub-menu {
      display: block;
    }
  
  @include cf();
} 


$navbg : #D2D7D3;
$topcolor : #6C7A89;
$topactivecolor : #F2784B;
$subbg : #34495e;
$sublink : #F2F1EF;
$sublinkactivebg : #2C3E50;
$nestedbg : #2C3E50;
$currentcolor : $topcolor;
  
/* THEME  */
.navbar {
  background: $navbg;
  @include cf();
}

.menu {
  width: 100%;
  
  li {
    border-right:1px dotted #ECECEC;
    width: 25%;
    &:last-child {
      border-right:none;
    }
  }
  
  a {
    color :$topcolor;
    font-size :0.75rem;
    text-decoration :none;
    text-transform :uppercase;
    padding: 0 0.75rem; 
    
    &:hover,
    &.active {
      color : $topactivecolor;
      /* border-bottom: 1px solid; */
    }
  }
  
    %arrow {
      line-height:1em; 
      font-size:6px; 
      padding-left:6px; 
      position:relative;
      top:-2px;
    }
  
  /* Change this in order to change the Dropdown symbol */
  .sub-menu li > a:after { 
    @extend %arrow;
    content: ' \25B6'; 
    
  } 
  
  li > a:after { 
    @extend %arrow;
    content: ' \25BC'; 

  } 
  li > a:only-child:after,
  .sub-menu li > a:only-child:after { 
    content: ''; 
  }
  
   // Drop Down Menus
  .sub-menu {
    background:$subbg;
    padding :$subPadding;
    li {
      border-right:none;
    }
    a {
      color:$sublink;
      /* padding: 0.35rem ($menuHeight / 2); */
      &:hover {
        background: $sublinkactivebg;
        border-bottom: none;
      }
    }
    &:before {
      content : '';
      border-bottom: 14px solid $subbg;
      border-right:14px solid transparent;
      position : absolute;
      top: -14px;
      left: 0;
    }

    // Nested Drop Down Menus
    .sub-menu {
        background : $nestedbg;
        &:before {
          content : ' ';
          border-right: 14px solid $nestedbg;
          border-bottom:14px solid transparent;
          position : absolute;
          top: 0;
          left: -14px;  
        }

      li a:hover,
      li a:active {
          background: $subbg;
        }
    }

  } // end sub-menus
  
  .active,
  .current_page_item a,
  .current-menu-item a {
    color : $currentcolor;
  }
  
}




/* DEMO PAGE STYLE */
html{
    padding:40px;
    background:#ECF0F1;
}

h1 {
    color : #2c3e50;
    text-transform:uppercase; 
    text-align:center;
    font-size:14px;
    line-height:21px;
    letter-spacing:10px;
    margin: 48px auto 0;
}


h1+p {
    font-size:14px;
    font-family:serif;
    font-style:italic;
    color: #b5bfc1;
    text-align:center;
    border-top:1px dotted #ccc;
    width:360px;
    padding: 12px;
    margin:12px auto 48px;
}



              
            
!

JS

              
                
              
            
!
999px

Console