Demo
  • 2.63 KB
  • HTML, CSS
  • Menu
  • dropdown, horizontal
  • MIT License
HTML
<nav role="navigation">
    <ul>
        <li><a href="#">Home</a></li>
        <li>
            <a href="#">About</a>
            <ul>
                <li><a href="">Our team</a></li>
                <li><a href="">History</a></li>
            </ul>
        </li>
        <li><a href="#">Clients</a></li>
        <li>
            <a href="#">Contact Us</a>
            <ul>
                <li><a href="">Address</a></li>
                <li><a href="">Managers</a></li>
            </ul>
        </li>
    </ul>
</nav>
CSS
@import url(https://fonts.googleapis.com/css?family=Lato);
*,
*:before,
*:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    font-family: "Lato", sans-serif;
}
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    -webkit-box-shadow: 0 3px 10px -2px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: 0 3px 10px -2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 3px 10px -2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

nav ul {
    list-style: none;
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: flex;
    padding: 0;
    margin: auto;
    max-width: 70%;
}

nav ul li {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: flex;
    margin: auto;
    -webkit-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}

nav ul li:hover {
    background: rgba(0, 0, 0, 0.15);
}

nav ul li:hover > ul {
    display: block;
}

nav ul li {
    float: left;
    -webkit-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}

nav ul li a {
    display: block;
    padding: 30px 20px;
    color: #222;
    font-size: 0.9em;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
}

nav ul ul {
    display: none;
    background: #fff;
    position: absolute;
    top: 100%;
    -webkit-box-shadow: -3px 3px 10px -2px rgba(0, 0, 0, 0.1);
    -moz-box-shadow: -3px 3px 10px -2px rgba(0, 0, 0, 0.1);
    box-shadow: -3px 3px 10px -2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

nav ul ul li {
    float: none;
    position: relative;
}

nav ul ul li a {
    padding: 15px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

nav ul ul ul {
    position: absolute;
    left: 100%;
    top: 0;
}

The code snippet we’re looking into creates a sleek and user-friendly dropdown menu embedded within a horizontal menu structure, perfect for a website’s navigation bar. At the heart of this setup is the HTML

  •  Menu #94
    Menu #23
    Menu #23
    • HTML, CSS, JS
    • 9.83 KB
    • Vertical
    View Details
  •  Menu #95
    Menu #22
    Menu #22
    • HTML, CSS
    • 5.96 KB
    • Dropdown, Vertical
    View Details
  •  Menu #95
    Menu #21
    Menu #21
    • HTML, CSS
    • 1.62 KB
    • Sidebar, Sliding, Vertical
    View Details
  •  Menu #94
    Menu #20
    Menu #20
    • HTML, CSS
    • 4.94 KB
    • Sliding, Vertical
    View Details
  •  Menu #94
    Menu #19
    Menu #19
    • HTML, CSS
    • 8.15 KB
    • Hamburger, Sliding, Vertical
    View Details
  •  Menu #94.5
    Menu #18
    Menu #18
    • HTML, CSS
    • 2.87 KB
    • Vertical
    View Details
Menu