Creating a Mega DropDown Menu with CSS 3

In this tutorial, we will see " How to Create a Mega DropDown Menu with CSS 3 ".  As you know Navigation is one of most important element of websites. That's how visitors can browse between your web pages. In my opinion if you dont have a good looking also functional navigation bar, your visitors will get bored easily and wont stay too long or re-visit your website again. Its just like a building has 100 floors without an elevator. Well here we have a great reason to learn CSS to build great nav bars.

You can re-design/re-edit it as you desire. Please let me if you have any questions. Thanks for reading.

Live Demohttp://www.gokhanmorkoc.com/cssmenutest/

Screenshot



HTML



<!DOCTYPE html>

<html lang="en">

<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css">

<style>
html,body{height:100%}body{margin:50px auto;background:#f9f7f4;min-height: 700px;}
#menu-wrapper { margin: 0 auto; width: 1100px; }
</style>

</head>
<body>

<div id="menu-wrapper">
<ul class="nav">
<li>
<a href="#">FURNITURE</a>
<div>
<div class="nav-column">
<h3 class="orange">Bedroom Furniture</h3>
<ul>
<li><a href="#">Beds</a></li>
<li><a href="#">Headboards</a></li>
<li><a href="#">Dressers & Chests</a></li>
<li><a href="#">Mattresses</a></li>
<li><a href="#">View All</a></li>
</ul>

<h3 class="orange">Living Room Furniture</h3>
<ul>
<li><a href="#">Sofas Sectionals</a></li>
<li><a href="#">Chairs Recliners</a></li>
<li><a href="#">Coffee Tables & Accent Tables</a></li>
        <li><a href="#">View All</a></li>
</ul>

    <h3 class="orange">Home Entertainment</h3>
<ul>
<li><a href="#">TV Stands</a></li>
<li><a href="#">Entertainment Centers</a></li>
<li><a href="#">Home Theater Mounts and Screens</a></li>
        <li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
<h3 class="orange">Living Room Furniture</h3>
<ul>
<li><a href="#">Sofas Sectionals</a></li>
<li><a href="#">Chairs Recliners</a></li>
<li><a href="#">Coffee Tables & Accent Tables</a></li>
        <li><a href="#">View All</a></li>
</ul>

<h3 class="orange">Bedroom Furniture</h3>
<ul>
<li><a href="#">Beds</a></li>
<li><a href="#">Headboards</a></li>
<li><a href="#">Dressers & Chests</a></li>
<li><a href="#">Mattresses</a></li>
<li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
    <h3 class="orange">Home Entertainment</h3>
<ul>
<li><a href="#">TV Stands</a></li>
<li><a href="#">Entertainment Centers</a></li>
<li><a href="#">Home Theater Mounts and Screens</a></li>
        <li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
    <h3 class="orange">Home Entertainment</h3>
<ul>
<li><a href="#">TV Stands</a></li>
<li><a href="#">Entertainment Centers</a></li>
<li><a href="#">Home Theater Mounts and Screens</a></li>
        <li><a href="#">View All</a></li>
</ul>

<h3 class="orange">Living Room Furniture</h3>
<ul>
<li><a href="#">Sofas Sectionals</a></li>
<li><a href="#">Chairs Recliners</a></li>
<li><a href="#">Coffee Tables & Accent Tables</a></li>
        <li><a href="#">View All</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#">DECOR</a></li>
<li>
<a href="#">LIGHTING</a>
<div>
<div class="nav-column">
    <h3 class="orange">Home Entertainment</h3>
<ul>
<li><a href="#">TV Stands</a></li>
<li><a href="#">Entertainment Centers</a></li>
<li><a href="#">Home Theater Mounts and Screens</a></li>
        <li><a href="#">View All</a></li>
</ul>

<h3 class="orange">Bedroom Furniture</h3>
<ul>
<li><a href="#">Beds</a></li>
<li><a href="#">Headboards</a></li>
<li><a href="#">Dressers & Chests</a></li>
<li><a href="#">Mattresses</a></li>
<li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
    <h3 class="orange">Home Entertainment</h3>
<ul>
<li><a href="#">TV Stands</a></li>
<li><a href="#">Entertainment Centers</a></li>
<li><a href="#">Home Theater Mounts and Screens</a></li>
        <li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
<h3 class="orange">Bedroom Furniture</h3>
<ul>
<li><a href="#">Beds</a></li>
<li><a href="#">Headboards</a></li>
<li><a href="#">Dressers & Chests</a></li>
<li><a href="#">Mattresses</a></li>
<li><a href="#">View All</a></li>
</ul>

<h3 class="orange">Living Room Furniture</h3>
<ul>
<li><a href="#">Sofas Sectionals</a></li>
<li><a href="#">Chairs Recliners</a></li>
<li><a href="#">Coffee Tables & Accent Tables</a></li>
        <li><a href="#">View All</a></li>
</ul>
</div>

<div class="nav-column">
<h3 class="orange">Bedroom Furniture</h3>
<ul>
<li><a href="#">Beds</a></li>
<li><a href="#">Headboards</a></li>
<li><a href="#">Dressers & Chests</a></li>
<li><a href="#">Mattresses</a></li>
<li><a href="#">View All</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#">KITCHEN</a></li>
<li><a href="#">BED & BATH</a></li>
<li><a href="#">OUTDOOR</a></li>
<li><a href="#">HOME IMPROVEMENT</a></li>
<li><a href="#">BABY & KIDS</a></li>
<li><a href="#">MORE</a></li>
<li><a href="#">SALES </a></li>
<li><a href="#">HOLIDAY</a></li>
<li class="nav-search">
<form action="#">
<input type="text" placeholder="Search">
<input type="submit" value="">
</form>
</li>
</ul>

</div>
</body>
</html>



CSS 



/* Reset */
.nav,
.nav a,
.nav ul,
.nav li,
.nav div,
.nav form,
.nav input {
margin: 0;
padding: 0;
border: none;
outline: none;
}

.nav a { text-decoration: none; }

.nav li { list-style: none; }

/* Menu Container */
.nav {
display: inline-block;
position: relative;
cursor: default;
z-index: 500;
}

/* Menu List */
.nav > li {
display: block;
float: left;
}

/* Menu Links */
.nav > li > a {
position: relative;
display: block;
z-index: 510;
height: 54px;
padding: 0 10px;
line-height: 54px;

font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #fcfcfc;
text-shadow: 0 0 1px rgba(0,0,0,.35);

background: #716c65;

-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
transition: all .3s ease;
}

.nav > li:hover > a { background: white; color:black; }

.nav > li:first-child > a {
border-radius: 3px 0 0 3px;
border-left: none;
}

/* Search Form */
.nav > li.nav-search > form {
position: relative;
width: inherit;
height: 54px;
z-index: 510;
    color:white;
}

.nav > li.nav-search input[type="text"] {
display: block;
float: left;
width: 0px;
height: 24px;
padding: 15px 0;
line-height: 24px;

font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: white;
text-shadow: 0 0 1px rgba(0,0,0,.35);

background: #716c65;

-webkit-transition: all .3s ease 1s;
-moz-transition: all .3s ease 1s;
-o-transition: all .3s ease 1s;
-ms-transition: all .3s ease 1s;
transition: all .3s ease 1s;
}

.nav > li.nav-search input[type="text"]:focus { color: white; }

.nav > li.nav-search input[type="text"]:focus,
.nav > li.nav-search:hover input[type="text"] {
width: 50px;
padding: 15px 20px;
    color:white;
-webkit-transition: all .3s ease .1s;
-moz-transition: all .3s ease .1s;
-o-transition: all .3s ease .1s;
-ms-transition: all .3s ease .1s;
transition: all .3s ease .1s;
}

.nav > li.nav-search input[type="submit"] {
display: block;
float: left;
width: 20px;
height: 54px;
padding: 0 25px;
cursor: pointer;
    color:white;

background: #716c65 url(../img/search-icon.png) no-repeat center center;

border-radius: 0 3px 3px 0;

-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
transition: all .3s ease;
}

.nav > li.nav-search input[type="submit"]:hover { background-color: #4b4441; color:white; }

/* Menu Dropdown */
.nav > li > div {
position: absolute;
display: block;
width: 100%;
top: 50px;
left: 0;

opacity: 0;
visibility: hidden;
overflow: hidden;

background: #ffffff;
border-radius: 0 0 3px 3px;

-webkit-transition: all .3s ease .15s;
-moz-transition: all .3s ease .15s;
-o-transition: all .3s ease .15s;
-ms-transition: all .3s ease .15s;
transition: all .3s ease .15s;
}

.nav > li:hover > div {
opacity: 1;
visibility: visible;
overflow: visible;
}

/* Menu Content Styles */
.nav .nav-column {
float: left;
width: 20%;
padding: 2.5%;
}

.nav .nav-column h3 {
margin: 20px 0 10px 0;
line-height: 18px;

font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 14px;
color: #716c65;
text-transform: uppercase;
}

.nav .nav-column h3.orange { color: #ff722b; }

.nav .nav-column li a {
display: block;
line-height: 26px;

font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #888888;
}

.nav .nav-column li a:hover { color: #666666; }


Comments