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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <ul class="nav">
    <li><a href="#">nav item</a></li>
    <li><a href="#">nav item</a></li>
    <li><a href="#">dropdown</a>
        <ul>
          <li><a href="#">sub item</a></li>
          <li><a href="#">dropdown</a>
              <ul>
                  <li><a href="#">sub item</a></li>
                  <li><a href="#">sub Item</a></li>
              </ul>
          </li>
          <li><a href="#">sub item</a></li>
        </ul>
    </li>
    <li><a href="#">nav item</a></li>
    <li><a href="#">nav item</a></li>
</ul>
              
            
!

CSS

              
                /* Box-sizing FTW*/
*, *:after, *:before {
  box-sizing: border-box; 
}

body{
  font-size: 0.875em;
  padding: 2em;
}

.nav, .nav ul, .nav li{
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav{
  display: block;
  position:relative;
  height: 2.500em;
  line-height: 2.500em;
  width: 62.500em;
  max-width: 100%;
  min-width: 48.000em;
  margin: 0px auto;
  border: 1px solid #d2d2d2;
  padding: 0 1em;
  border-radius: 0.313em;
  box-shadow: inset 0 0.063em 0 0 rgba(255,255,255,0.9), 0 0.063em 0 0 rgba(0,0,0,0.25), 0 0.063em 0.625em 0 rgba(0,0,0,0.10);
  background: #f1f1f1;
  background-image: -webkit-linear-gradient(top, #f1f1f1, #dbdbdb);
  background-image:  linear-gradient(to bottom, #f1f1f1, #dbdbdb);
  text-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 -1px 0 rgba(0,0,0,0.3);
}
/*clearfix */
.nav:before,
.nav:after {
	content:""; display:table;
}

.nav:after {
	clear: both;
}

.nav {
  zoom: 1;
}

.nav li {
  display:block;
	float: left;
	position: relative;
  border-right: 1px solid #fff;
}

.nav > li:first-child{
  border-left: 1px solid #d2d2d2;
}

.nav li a {
  font-size: 1em;
  height:2.500em;
  padding: 0 1.250em;
  position:relative;
  display: block;
  color: #555;
  text-decoration: none;
  border-right: 1px solid #d2d2d2;
  z-index: 200; /*prevent issues with link's pseudo elements and the proximity detection*/
}

.nav > li:first-child a {
  border-left: 1px solid #fff;
}

.nav li:hover{
  background:#d5d5d5;
}

.nav li a:hover {
  color:#000;
  background:#d5d5d5;
  box-shadow: inset 0 0.188em 0.500em rgba(0, 0, 0, 0.125);
}

.nav li a:active {
  color:#666;
  background: #e6e6e6;
}

/* Dropdown
   ========================================================================== */

/* Target menu item with dropdown inside */
.nav li a:nth-last-child(2){
  padding-right: 2.500em;
}

.nav li a:nth-last-child(2):after{
  content: "\25BC"; /* add down-pointing triangle to dropdown parent */
  position: absolute;
  right: 1.250em;	
}

.nav li li a:nth-last-child(2):after{
  content: "\25B6"; /* add left down-pointing triangle to any deeper level sub menu parents */
}

/* dropdown funcionality*/
.nav li ul  {
  display:none;
  border: 1px solid #d2d2d2;
  position: absolute;
  background: #F1F1F1;
  white-space: nowrap;
  box-shadow: inset 0 0.063em 0.063em 0 rgba(0,0,0,0.25), 0 0.063em 0.625em 0 rgba(0,0,0,0.10);
}

/* positioning for second and deeper level sub menus */
.nav ul ul {
	left: 100%; 
	top: 0;
}

.nav li:hover > ul {
  display: block; /* show sub menus when hovering over a parent */
	z-index: 10;
}

/*sub nav items*/
.nav li li {
	float:none;
	position:relative;
  border-right: 0 !important;
}

.nav li li a{
  border-right: 0 !important;
}

/*proximity detection for submenu*/
.nav li ul:before {
	display:block;
	content: "";
	width: 160%;
	height: 120%;
	background: none !important;
	position: absolute;
	left: -30%;
}

/* proximity detection for second and deeper level sub menus */
.nav ul ul:before {
	height: 150%;
	top: -20%;
}
              
            
!

JS

              
                
              
            
!
999px

Console