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

              
                <!-- Menu markup start -->
<nav>
  <ul>
    <li><a href="">Home</a></li>
    <li><a href="">Articles</a>
      <ul>
        <li><a href="">CSS</a></li>
        <li><a href="">WooCommerce</a></li>
        <li><a href="">WordPress</a>
          <ul>
            <li><a href="">Entry 1</a></li>
            <li><a href="">Entry 2</a>
              <ul>
                <li><a href="">Sub Entry 1</a></li>
                <li><a href="">Sub Entry 2</a></li>

              </ul>
            </li>
          </ul>
        </li>
        <li><a href="">PHP</a></li>
      </ul>
    </li>
    <li><a href="">Contact</a></li>
    <li><a href="">Find us</a>
      <ul>
        <li><a href="">Item 1</a></li>
      </ul>
    </li>
  </ul>
</nav>
<!-- Menu markup end -->
<div>
  <h1>This is a Minimalist and Pure CSS Dropdown & Responsive Menu</h1>
  <div>Only 30 lines of raw CSS or 0.3 Kb; by <a href="http://www.alticreation.com/en">alticreation</a>
  </div>
</div>
              
            
!

CSS

              
                /* breakpoint in pixels for responsive */

$breakpoint: 980px;

/* dropdown Menu core scss */

ul {
  display: inline-block;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  li {
    position: relative;
    display: inline-block;
    &:hover {
      > ul {
        display: inherit;
        li {
          display: list-item;
        }
      }
    }
    a {
      display: block;
    }
    ul {
      display: none;
      position: absolute;
      /* optional: submenu is same width than parent entry width */
      min-width: 100%;
      /* optional: submenu background color */
      background-color: #aaa;
      ul {
        left: 100%;
        top: 0;
      }
    }
  }
}


/* Responsiveness core scss */

@media (max-width: $breakpoint) {
  ul {
    display: inherit;
    &:first-child:before {
      background-color: #222;
      content: 'MENU';
      display: block;
      padding: 1rem;
      color: #fff;
      text-align: right;
    }
    &:active,
    &:focus,
    &:hover {
      li {
        display: list-item;
      }
    }
    li {
      display: none;
      background-color: #aaa;
      ul {
        position: relative;
        min-width: auto;
        display: inherit;
        border-top: 2px solid #999;
        li {
          display: block;
          a {
            position: relative;
            &:before {
              content: '';
              padding-left: 1.5%;
            }
          }
          ul {
            left: 0;
          }
        }
      }
    }
  }
}


/* ------------- optional styling below ------------ */


/* Following declarations are OPTIONAL */

body {
  background-color: #ddd;
  font-family: Arial;
}

html,
body {
  margin: 25px;
}
body {
  overflow-Y: scroll;
}

nav {
  background-color: #333;
  margin-bottom: 50px;
  ul {
    li {
      &:hover {
        background-color: #888;
      }
    }
  }
}

a {
  color: #fff;
  text-decoration: none;
  padding: 15px;
  &:hover {
    background-color: rgba(0, 0, 0, 0.2);
  }
}

li > a:after {
  content: ' +';
  float: right;
  margin-left: 5px;
}

li > a:only-child:after {
  content: '';
}

div {
  font-size: 2rem;
  h1 {
    border-left: 7.5px solid #bbb;
    font-size: 2rem;
    padding-left: 15px;
    display: inline-block;
    font-weight: 100;
  }
  div {
    font-size: 1rem;
    padding-left: 15+7.5px;
    font-style: italic;
    color: #666;
    a {
      color: #333;
      padding: 0;
      text-decoration: underline;
    }
  }
}
              
            
!

JS

              
                /*
This a minimalist and Pure CSS DropDown Menu that can be used as a starter to build your navigation menu.

Author: Alexis Blondin
Url: http://www.alticreation.com/en
*/
              
            
!
999px

Console