cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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 class="nav">
    <ul class="navigation-main">
      <li><a href="#">Home</a></li>
      <li class="menu-item-has-children">
        <a href="#">Categories</a>
        <ul>
          <li><a href="#">News</a></li>
          <li><a href="#">Sports</a></li>
          <li class="menu-item-has-children">
            <a href="#">Fashion</a>
            <ul>
              <li><a href="#">Article #1</a></li>
              <li><a href="#">Article #2</a></li>
            </ul>
          </li>
          <li><a href="#">Business</a></li>
        </ul>
      </li>
      <li class="menu-item-has-children current-menu-ancestor">
        <a href="#">Blog</a>
        <ul>
          <li><a href="#">News</a></li>
          <li><a href="#">Sports</a></li>
          <li class="menu-item-has-children current-menu-ancestor">
            <a href="#">Fashion</a>
            <ul>
              <li><a href="#">Style</a></li>
              <li class="menu-item-has-children current-menu-item">
                <a href="#">Looks</a>
                <ul>
                  <li><a href="#">Article #1</a></li>
                  <li><a href="#">Article #2</a></li>
                </ul>
              </li>
            </ul>
          </li>
          <li><a href="#">Business</a></li>
        </ul>
      </li>
      <li><a href="#">About</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </nav>
</header>
            
          
!
            
              $background-color: #145474 !default;
$link-color: #fff !default;
$link-active-color: #ffcc03 !default;

.header {
  background-color: $background-color;
  display: flex;
  align-items: center;
}

.nav {
  width: 100%;
}

.navigation-main {
  //
  // Structural Styles
  //
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  text-align: center;
  
  ul {
    min-width: 150px;
    margin: 0;
    padding: 0;
    list-style: none;
    position: absolute;
    top: -999em;
    left: -999em;
  }
  
  li {
    display: inline-block;
    position: relative;
    text-align: left; // Reset text alignment

    &.focus,
    &:hover {
      > ul {
        top: auto;
        left: auto;
      }
    }
    
    li {
      display: block;
      
      &.focus,
      &:hover {
        > ul {
          left: 100%;
          top: 0;
        }
      }
    }
  }
  
  //
  // Presentational Styles
  //

  // Global menu link styles
  a {
    color: $link-color;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    padding: 10px 15px;
  }
  
  // Active & hover styles
  a:hover,
  li:hover > a,
  .focus > a,
  .current-menu-item > a,
  .current-menu-ancestor > a {
    color: $link-active-color;
  }
  
  // First level item arrows
  .menu-item-has-children {
    > a {
      &::before {
        content: "";
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        border: 4px solid transparent;
        border-top-color: currentColor; // Nifty trick to always keep the arrow colored the same as the menu item's text in every different state 
      }
    }
  }
  
  // Second level item arrows
  ul {
    .menu-item-has-children {
      > a {
        &::before {
          right: 2px;
          border-top-color: transparent;
          border-left-color: currentColor;
        }
      }
    }
  }
  
  // Submenu styles
  ul {
    background-color: $background-color;
  }
}
            
          
!
            
              jQuery(function ($) {
  var siteNavigation = $('.navigation-main');
  
  siteNavigation.find( 'a' ).on( 'focus blur', function() {
    $( this ).parents( 'li' ).toggleClass( 'focus' );
  });
});
            
          
!
999px
Loading ..................

Console