Super Flat Multilevel Dropdown Menu with Pure CSS

Category: CSS & CSS3 , Menu & Navigation | June 16, 2015
Author: SoClear
Views Total: 3,509
Official Page: Go to website
Last Update: June 16, 2015
License: MIT

Preview:

Super Flat Multilevel Dropdown Menu with Pure CSS

Description:

A pure CSS approach to building flat style multilevel dropdown menu for your site’s navigation.

How to use it:

Wrap your hierarchical menu items into nested html lists.

<nav class="menu">
  <ul>
    <li><a href="">Menu One</a>
      <ul>
        <li><a href="">Sub Menu One</a></li>
        <li><a href="">Sub Menu One</a>
          <ul>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a></li>
          </ul>
        </li>
      </ul>
    </li>
    <li><a href="">Menu One</a>
      <ul>
        <li><a href="">Sub Menu One</a></li>
        <li><a href="">Sub Menu One</a></li>
        <li><a href="">Sub Menu One</a>
          <ul>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a></li>
            <li><a href="">Sub Menu Two</a>
              <ul>
                <li><a href="">Sub Menu Three</a></li>
                <li><a href="">Sub Menu Three</a></li>
                <li><a href="">Sub Menu Three</a></li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
    </li>
    <li><a href="">Menu One</a></li>
    <li><a href="">Menu One</a></li>
  </ul>
</nav>

The core CSS to active the dropdown menu.

.menu {
  background-color: #fff;
  width: 100%;
  height: 60px;
}

.menu ul {
  background-color: #fff;
  text-align: center;
}

.menu ul li ul {
  display: none;
  opacity: 0;
  position: absolute;
  top: 60px;
  width: 100%;
  background-color: #fff;
  transform: all .5s;
}

.menu ul li ul:hover {
  display: block;
  opacity: 1;
}

.menu ul li ul li { width: 100%; }

.menu ul li ul li ul {
  position: absolute;
  top: 0;
  left: 100%;
}

.menu li {
  width: 25%;
  float: left;
  position: relative;
}

.menu li a {
  display: block;
  color: #666;
  line-height: 60px;
}

.menu li a:hover { background-color: #f0f0f0; }

.menu li a:hover + ul {
  display: block;
  opacity: 1;
}

You Might Be Interested In:


Leave a Reply