I've been having a problem. I can't get a drop-down to work at all, I've tried tutorials and other various sources on the internet with no luck. So I've decided to try and see if someone can help me.
HTML:
<div class="nav-wrapper">
<div class="nav">
<div class="pilot-main-login">
<img src="css/images/pilotloginicon.png">
</div>
<nav>
<ul>
<li>
<a href="index.php">Home</a>
</li><li>
<a href="#">About</a>
</li><li>
<a href="#">Operations</a>
</li><li>
<a href="#">Pilot Application</a>
</li><li>
<a href="#">VX Tracker</a>
</li><li>
<a href="#">Contact Us</a>
</li>
</ul>
</nav>
</div>
</div>
CSS:
.nav-wrapper{
width:100%;
height: 55px;
background-color: #E20000;
-webkit-box-shadow: 0px 0px 8px 2px #292827;
-moz-box-shadow: 0px 0px 8px 2px #292827;
box-shadow: 0px 0px 8px 2px #292827;
}
.nav{
width: 960px;
margin-left: auto;
margin-right: auto;
font-size: 16px;
font-family: 'Ubuntu', sans-serif;
}
.nav ul{
margin: 0;
padding: 0;
list-style-type: none;
}
.nav li{
line-height: 55px;
text-align: center;
display: inline-block;
}
.nav li a{
color: #FFF;
display: block;
text-decoration: none;
}
.nav a:hover{
background-color: #D40000;
}
.nav a{
padding-left: 30px;
padding-right: 30px;
}
Check this fiddle out
I have used the HTML you posted and added a submenu to "Operations" list item. When you are creating a simple drop-down on hover, make the main menu items
position: relavtive
. Make the submenu itemsul
absolute position
and position properties liketop
,left
,right
andbottom
to position the submenu items where you want to display when it is hovered and make the subemnu itemsul
hidden by usingdisplay:none
. Now on hover you can make the the sub-menu itemsul
visible usingdisplay: block
.HTML used
CSS used
Hope this might help you. Also if you have sub menus for the sub menu better names the
ul
items using class names. For eg:This will help you style the sub menu items as you need.