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.

            
              <div class="wrapper">
  <header class="main"></header>
  <div class="row main_navigation_container">
    <div class="ribbon-left"><i></i></div>
      <nav class="main top-bar">
        <ul class="mainMenu">
          <li class="current-menu-item">
            <a href="#">Home</a>
          </li>
          <li class="has-dropdown">
            <a href="#">First Product</a>
            <ul class="sub-menu dropdown">
              <li class="has-dropdown">
                <a href="#">Level 2 Item</a>
                <ul class="sub-menu dropdown">
                  <li>
                    <a href="#">Level 3 Item</a>
                  </li>
                  <li>
                    <a href="#">Level 3 Item</a>
                  </li>
                  <li>
                    <a href="#">Level 3 Item</a>
                  </li>
                  <li>
                    <a href="#">Level 3 Item</a>
                  </li>
                  <li>
                    <a href="#">Level 3 Item</a>
                  </li>
                </ul>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
            </ul>
          </li>
          <li class="has-dropdown">
            <a href="#">Second Product</a>
            <ul class="sub-menu dropdown">
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
            </ul>
          </li>
          <li class="has-dropdown">
            <a href="#">About Us</a>
            <ul class="sub-menu dropdown">
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
              <li>
                <a href="#">Level 2 Item</a>
              </li>
            </ul>
          </li>
          <li>
            <a href="#">Contact Us</a>
          </li>
          <li>
            <a href="#">Blog</a>
          </li>
        </ul>
      </nav>
    <div class="ribbon-right"><i></i></div>
  </div>
</div>
            
          
!
            
              @import "compass/css3";

$mainColor: #00608c;
$darkMain: darken($mainColor, 10%);
$white: #ffffff;
@import url(https://fonts.googleapis.com/css?family=Lora);

$bodyBg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/134921/bodyBg.png';
$containerBg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/134921/containerBg.png';
$navBg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/134921/navBg_1.png';

@mixin dashed(){
  position: absolute;
  top: 10%;
  bottom: 10%;
  width: 100%;
  left: 0;
  border-color: lighten($mainColor, 8%);
  border-style: dashed;
  border-width: 1px 0;
  pointer-events: none;
}

.main_navigation_container{
  background-color: $mainColor;
  @include background-image(linear-gradient(to top, rgba(0,0,0,.1), rgba(255,255,255,.1)), url($navBg));
  border: solid 1px $darkMain;
  position: relative;
  width: 102%;
  margin-left: -1%;
  border-radius: 3px;
  @include box-shadow(0 2px 2px rgba(0,0,0,.4), inset 0 2px 2px rgba(255,255,255,.4));
  &:before, &:after{
    content: '';
    position: absolute;
    height: 100%;
    top: 0;
    width: 2%;
    @include background-image(linear-gradient(left, rgba(53,53,53,.2) 0%,rgba(53,53,53,0) 100%));
  }
  &:after{
    right: 0;
    @include background-image(linear-gradient(right, rgba(53,53,53,.2) 0%,rgba(53,53,53,0) 100%));
  }
    nav.main{
      position: relative;
      z-index: 10;
      &:before, &:after{
        content: '';
        position: absolute;
        height: 110%;
        width: 30px;
        top: 0;
      }
      &:before{
        left: -30px;
        @include background-image(radial-gradient(right, ellipse cover, rgba(53,53,53,0.3) 0%,rgba(0,0,0,0) 70%));
      }
      &:after{
        right: -30px;
        @include background-image(radial-gradient(left, ellipse cover, rgba(53,53,53,0.3) 0%,rgba(0,0,0,0) 70%));
      }
      > ul{
        margin: 0;
        position: relative;
        padding-left: 2%;
        &:before, &:after{
          content: '';
          @include dashed();
        }
        &:after{
          top: calc(10% + 1px);
          bottom: calc(10% - 1px);
          left: 1px;
          border-bottom-color: darken($mainColor, 10%);
          border-top-color: darken($mainColor, 6%); //offset for gradient
        }
        li{
          list-style: none;
          position: relative;
          a{
            display: block;
            padding: 0 15px;
            line-height: 54px;
            color: $white;
            text-decoration: none;
            text-shadow: 1px 1px #000;
          }
        }
        >li{
          display: inline-block;
          ul{
            position: absolute;
            left: 0;
            background-color: $mainColor;
            background: url($navBg) repeat;
            display: none;
            padding: 0px;
            li a{
              white-space: nowrap;
              line-height: 40px;
              padding: 0 25px;
              border-bottom: 1px solid darken($mainColor, 5%);
              @include box-shadow( 0 1px 0 0 lighten($mainColor, 6%));
              &:hover{
                background: darken($mainColor, 5%); //for IE8
                background: rgba(0,0,0,0.2);
              }
            }
            li:last-child a{
              border-bottom: 0;
              @include box-shadow(none);
            }
            li.has-dropdown ul{
              left: 100%;
              top: 15px;
              @include box-shadow( inset 4px 0 4px -2px rgba(0,0,0,.4));
            }
          }
          > ul{
            @include box-shadow( inset 0 4px 4px -2px rgba(0,0,0,.4));
          }
        }
      }
    }
  }
#magic-line{
  position: absolute;
  width: 100%;
  height: 60%;
  top: 20%;
  left: 0%;
  border-radius: 16px;
  background-color: rgba(0,0,0,.4);
  z-index: -1;
  @include box-shadow(inset -1px -1px 1px rgba(246,242,226,.4), inset 0 0 7px rgba(0,0,0,.25));
}

.ribbon-left, .ribbon-right{
  position: absolute;
  height: 55px;
  width: 40px;
  overflow: hidden;
  top: 10px;
  z-index: -2;
  &:before, &:after{
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background-color: $mainColor;
    background: url($navBg);
  }
  i{
    @include dashed();
    width: 80%;
    z-index: 20;
    &:after{
      content: '';
      position: absolute;
      width: 0;
      height: 0;
      bottom: -10%;
    }
  }
}
.ribbon-left{
  left: -30px;
    &:before{
    background: $mainColor;
    @include rotate(-35deg);
    top: -55px;
    right: -17px;
  }
  &:after{
    @include rotate(35deg);
    bottom: -55px;
    left: -4px;
  }
  i{
    right: 0;
    left: auto;
    &:after{
      right: 0;
      border-top: 10px solid darken($mainColor, 15%);
      	border-left: 10px solid transparent;
    }
  }
}
.ribbon-right{
  right: -30px;
    &:before{
    background: $mainColor;
    @include rotate(-35deg);
    bottom: -55px;
    left: -17px;
  }
  &:after{
    @include rotate(35deg);
    top: -55px;
    right: -4px;
  }
  i:after{
    left: 0;
    border-top: 10px solid darken($mainColor, 15%);
    border-right: 10px solid transparent;
  }
}

//for pen only
body{
  font-family: 'Lora', serif;
  font-size: 1em;
  background: url($bodyBg);
}

.wrapper{
  width: 650px;
  margin: 0 auto;
  padding-top: 100px;
  height: 300px;
  background: url($containerBg);
  @include box-shadow(0 0 30px rgba(42,40,40,.2));
}
            
          
!
            
              $('li.has-dropdown').hover(function(){
    $(this).find('>.dropdown').stop().slideToggle( 300 );
});


//props to chris coyier and his magic line tutorial https://css-tricks.com/jquery-magicline-navigation/
$(function() {

    var $el, leftPos, newWidth,
        $mainNav = $(".mainMenu");
    
    $mainNav.append("<li id='magic-line'></li>");
    var $magicLine = $("#magic-line");
    
   if($('.mainMenu>li').hasClass('current-menu-item')){
	    $magicLine
	        .width($(".current-menu-item").width())
	        .css("left", $(".current-menu-item").position().left)
	        .data("origLeft", $(".current-menu-item").position().left)
	        .data("origWidth", $magicLine.width());
	    }else if($('.mainMenu>li').hasClass('current-menu-ancestor')){ 
		    $magicLine
	        .width($(".current-menu-ancestor").width())
	        .css("left", $(".current-menu-ancestor").position().left)
	        .data("origLeft", $(".current-menu-ancestor").position().left)
	        .data("origWidth", $magicLine.width());
	    }else{
		    $magicLine
	        .width(0)
	        .css("left", 0)
	        .data("origLeft", 0)
	        .data("origWidth", $magicLine.width());
	    }
        
    $("nav.main > ul > li").hover(function() {
        $el = $(this);
        leftPos = $el.position().left;
        newWidth = $el.width();
        $magicLine.stop().animate({
            left: leftPos,
            width: newWidth
        });
    }, function() {
        $magicLine.stop().animate({
            left: $magicLine.data("origLeft"),
            width: $magicLine.data("origWidth")
        });    
    });
});
            
          
!
999px
Loading ..................

Console