I am trying to create a drop-down menu that should have 2 levels of dropdown. I want the a menu item (Product), when I hover over its sub-menu(Our Brands) it should come with an arrow and drop-down to side.
Demo :- https://jsfiddle.net/nnefhpxf/
HTML
<div id="navbar-collapse-grid" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id = "drop-nav">
<li><a class="active" href="index.html">Home</a></li>
<li class="dropdown">
Our Company
<div class="dropdown-content">
Company Overview
Management
Manufacturing
Business
</div>
</li>
<li class="dropdown">
Product
<div class="dropdown-content">
Our Brand
<ul>
<li>Intes-o</li>
<li>Frig-M</li>
<li>Rahat</li>
<li>Zesund</li>
<li>Bioti 1gm I.V</li>
<li>Vomiss I.V</li>
</ul>
New Brand Releases
</div>
</li>
<li>Mission</li>
<li>Vision</li>
<li>Contact Us</li>
</ul>
</div>
css
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: gray;
font-size: 17px;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #75c5cf;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgb3a(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
Try this. The hover arrow on the brand item I have uploaded from the local. Please check the below code.
/* css */
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: gray;
font-size: 17px;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #75c5cf;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
.sub-mnu {
position: absolute;
left: 174px;
top: 0px;
}
.dropdown-content ul {
display: none;
}
.dropdown-content:hover ul {
display: block;
}
.brnd {
background-image: url(https://www.dropbox.com/s/fhjnwgbokn8i8eo/arrow.png);
background-position: right;
background-repeat: no-repeat;
}
<div id="navbar-collapse-grid" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id="drop-nav">
<li><a class="active" href="index.html">Home</a>
</li>
<li class="dropdown">
Our Company
<div class="dropdown-content">
Company Overview
Management
Manufacturing
Business
</div>
</li>
<li class="dropdown">
Product
<div class="dropdown-content">
Our Brand
<ul class="sub-mnu">
<li>Intes-o
</li>
<li>Frig-M
</li>
<li>Rahat
</li>
<li>Zesund
</li>
<li>Bioti 1gm I.V
</li>
<li>Vomiss I.V
</li>
Zesund
</ul>
New Brand Releases
</div>
</li>
<li>Mission
</li>
<li>Vision
</li>
<li>Contact Us
</li>
</ul>
</div>
Related
How do i float the font awesome search icon to the right next to sign up.
Here is a screenshot of my nav bar, so you know what i am referring too:
https://imgur.com/rE23FfB
I have search the internet for tutorials and they all say to use float: right; but that seems to not work
body {
margin: 0;
padding: 0;
margin-top: 130px;
overflow-x: hidden;
}
.nav-menu a img {
float: left;
margin-left: 10px;
}
.nav-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.9);
margin-top: -130px;
}
.nav-menu li {
float: left;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
.nav-menu li.social {
float: right;
}
<div class="nav-menu">
<ul>
<img src="img/logo.jpg" style="width:50px">
<li class="dropdown">
Games
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li class="dropdown">
Crews
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
<li class="social">
Sign In
Sign Up
<li><i class="fas fa-search"></i></li>
</ul>
The problem is your <li> wrapping the search icon. This is an invalid code. <li> cannot be a children of an <li>. Change it to just an <a> element
body {
margin: 0;
padding: 0;
margin-top: 130px;
overflow-x: hidden;
}
.nav-menu a img {
float: left;
margin-left: 10px;
}
.nav-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.9);
margin-top: -130px;
}
.nav-menu li {
float: left;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
.nav-menu li.social {
float: right;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<div class="nav-menu">
<ul>
<li><img src="img/logo.jpg" style="width:50px"></li>
<li class="dropdown">
Games
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li class="dropdown">
Crews
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
<li class="social">
Sign In
Sign Up
<i class="fas fa-search"></i>
</li>
</ul>
</div>
I know I'm a little late to the question - but I have an improved solution (at least I think so)!
The syntax on the previous answer is still a little incorrect. You should also try to make your dropdowns into nested ul's. :-)
By using the display: flex and align-items: center on the .nav-menu, you will be aligning all the elements up without the use of float (which I tend to avoid anyway as it often makes your code behave like you would not expect).
I've also added margin-left:auto for you on your .social container, it will push all your social to the end of the parent.
EDIT:
If you use border-top: transparent on the menu items, this makes sure that the text doesn't move when you add in a coloured border on :hover - so you're essentially just showing the colour.
html,
body {
margin: 0;
padding: 0;
}
.nav-menu {
display: flex;
align-items: center;
background-color: rgba(0, 0, 0, 0.9);
}
.nav-menu img {
margin: 0 10px;
}
.nav-menu>ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
ul.social {
margin-left: auto;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
border-top: 2px solid transparent;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
list-style: none;
margin: 0;
padding: 0;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<!-- just for the example -->
<div class="nav-menu">
<img src="img/logo.jpg" style="width:50px">
<ul>
<li class="dropdown">
Games
<ul class="dropdown-content">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</li>
<li class="dropdown">
Crews
<ul class="dropdown-content">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
</ul>
<ul class="social">
<li>Sign In</li>
<li>Sign Up</li>
<li><i class="fas fa-search"></i></li>
</ul>
</div>
You can see the full effect if you view the snippet in full screen.
I can't see the contents in dropdown because another content is over them (i have iframe down and it covers the data of dropdown contents), i've tried to change the z-index to bigger values and set the position to relative but none of them works, the data in dropdowns are taken from another file:
#Menu-bar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color:black;
opacity: 0.7;
filter:alpha (opacity=70);
}
li {
float: left;
border-right: 1px solid #bbb;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 200;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
z-index: 200;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
#dropdownFollowing:hover .dropdown-content {
display: block;
}
<div id="Menu-bar">
<ul>
<li>
<a class="active" href="MainPage.php">
<img src="images/comp4.png" alt="">BIO
</a>
</li>
<li>
<a class="active" id="report-print"></a>
</li>
<li id="dropdownFollowing">
<a class="dropbtn"></a>
<div class="dropdown-content" id="contentFollow"></div>
</li>
<li id="dropdownFollowing">
<a class="dropbtn"></a>
<div class="dropdown-content" id="contentMessages"></div>
</li>
<li id="dropdownFollowing">
<a class="dropbtn" id="notf"></a>
<div class="dropdown-content" id="contentNotifications"></div>
</li>
<li style="float: right">
<img src="images/logout.png" alt="">
</li>
</ul>
</div>
Im not sure exactly what you are trying to do,
but to me it seems you cant see the content of the dropdowns because there is no content in them.
https://jsfiddle.net/0jjdzhm9/
<div id="Menu-bar">
<ul>
<li>
<a class="active" href="MainPage.php">
<img src="images/comp4.png" alt="">BIO
</a>
</li>
<li>
<a class="active" id="report-print"></a>
</li>
<li class="dropdownFollowing">
<a class="dropbtn">test</a>
<div class="dropdown-content" id="contentFollow">test</div>
</li>
<li class="dropdownFollowing">
<a class="dropbtn">test</a>
<div class="dropdown-content" id="contentMessages">test</div>
</li>
<li class="dropdownFollowing">
<a class="dropbtn" id="notf">Test</a>
<div class="dropdown-content" id="contentNotifications">Test</div>
</li>
<li style="float: right">
<img src="images/logout.png" alt="">
</li>
</ul>
</div>
#Menu-bar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color:black;
opacity: 0.7;
filter:alpha (opacity=70);
}
li {
float: left;
border-right: 1px solid #bbb;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 200;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
z-index: 200;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdownFollowing:hover .dropdown-content {
display: block;
}
also changed the #dropdownFollowing selector to a class (.dropdownFollowing:hover) as you have more than one using it.
I'm having an issue with the CSS of the navigation bar.This is what happens when I hover over .dropbtn.
Here's my HTML code for the drop down navigation bar.
<div class="nav-wrapper">
<ul id="nav">
<img id="logo" src="Images/dramay.jpg">
<li class="dropdown">
Movies & TV ⏷
<div class="dropdown-content">
<b style="font-size: 15px">MOVIES</b>
In Theaters
Coming Soon
Categories
Most Popular
<b style="font-size: 15px" > TV </b>
<a href="#" >Timings</a>
Latest shows
Top rated
</div>
</li>
<li class="dropdown">
Celebs & photos ⏷
<div class="dropdown-content">
<b style="font-size: 15px">Celebs</b>
Born today
Most popular
<b style="font-size: 15px">Photos</b>
latest stills
Latest posters
</div>
</li>
<li class="dropdown">
News ⏷
<div class="dropdown-content">
<b style="font-size: 15px">News</b>
Top news
Movies news
TV news
</div>
</li>
<li class="search" style="float:right;"><a>
<input type="text" name="firstname" placeholder="SEARCH">
</a>
</li>
<li class="dropdown" id="signIN">
Sign In
</li>
<li class="dropdown" id="signUP">
Sign Up
</li>
</ul>
</div>
And here's the CSS.
ul#nav {
list-style-type: none;
margin: 0;
padding: 0;
position: inherit;
width: 100%;
overflow: hidden;
background: #332;
}
.nav-wrapper
{
position: fixed;
width: 100%;
}
li {
float: left;
}
li a, .dropbtn {
display: inline-block;
color: lightgrey;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color:#00b300;
}
li a:hover, .search:hover {
background-color:black;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
color:black;
position: relative;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
font-size: 15px;
z-index: 1;
}
.dropdown-content a:hover {
background-color: #f1f1f1;
}
.dropdown:hover .dropdown-content {
display: block;
}
I have tried overflow:hidden on ul#nav and .nav-wrapper but none of it works.
(Apologies in advance for my bad english)
add following css
ul#nav {
overflow: visible;
}
ul#nav li {
position: relative;
}
.dropdown-content {
position: absolute;
left: 0px;
top: 100%;
}
Make 2 change in your css :-
1) Remove overflow: hidden; in ul#nav class
ul#nav {
list-style-type: none;
margin: 0;
padding: 0;
position: inherit;
width: 100%;
/*overflow: hidden;*/
background: #332;
}
2) Change position in .dropdown-content
.dropdown-content {
background-color: #f9f9f9;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
color: black;
display: none;
min-width: 160px;
position: absolute;
z-index: 1;
}
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.templatemo_menu {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.templatemo_menu:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
#templatemo_menu {
float: left;
height: 37px;
margin-top: 12px;
overflow:hidden;
}
<div id="templatemo_menu">
<ul>
<li>Home</li>
<li ><a href="Aboutus.html" class="dropbtn" >Coindia</a>
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
<li>Services</li>
<li>Facility</li>
<li>Photo Gallery</li>
<li>Careers</li>
</ul>
</div> <!-- end of templatemo_menu -->
I want to create submenu in HTML. Here i have created menu and submenu but it is not appearing properly. Please help me with this.i want the sub-menu open to down side when cursor is placed on it Here is the css and html relating to it
A few small edits will cause the drop down to work, there appears to be some other work left to do.
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.templatemo_menu {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.templatemo_menu .dropdown-content {
display: none;
}
.templatemo_menu:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
#templatemo_menu {
float: left;
height: 37px;
margin-top: 12px;
overflow:hidden;
}
<div>
<ul>
<li>Home</li>
<li class="templatemo_menu"><a href="Aboutus.html" class="dropbtn" >Coindia</a>
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
<li>Services</li>
<li>Facility</li>
<li>Photo Gallery</li>
<li>Careers</li>
</ul>
</div> <!-- end of templatemo_menu -->
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
#templatemo_menu {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
#templatemo_menu:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
#templatemo_menu {
float: left;
// height: 37px;
margin-top: 12px;
// overflow:hidden;
}
<div id="templatemo_menu">
<ul>
<li>Home</li>
<li ><a href="Aboutus.html" class="dropbtn" >Coindia</a>
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
<li>Services</li>
<li>Facility</li>
<li>Photo Gallery</li>
<li>Careers</li>
</ul>
</div> <!-- end of templatemo_menu -->
<div id="templatemo_menu"> You have given id templatemo_menu and in you css you have given .templatemo_menu.You have to use #templatemo_menu for id. Also change the style of #templatemo_menu
#templatemo_menu {
float: left;
// height: 37px;
margin-top: 12px;
//overflow:hidden;
}
I've searched through this code for errors that would keep it from working, but can't seem to find any. All appears well, except the menu will not dropdown. Does anyone have any tips?
Here is my code as snippet:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #5BC8C3;
position: fixed;
top: 60px;
width: 100%;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: #f7f7f7;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #F7f7f7;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #284A64;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: #f7f7f7;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f7f7f7
}
.dropdown:hover .dropdown-content {
display: block;
}
<ul>
<li><a class="active" href="#index">Home</a>
</li>
<li>Catalog
</li>
<li>Calendar
</li>
<li class="dropdown">
Library Information
<div class="dropdown-content">
Children's Programs
Adult Programs
Help Services
Other Services
Library Policies
</div>
</li>
<li>Contact
</li>
</ul>
Thank you for any advice!
Well, the dropdown-menu actually shows up :)
But we cannot see it, because your menu is
overflow: hidden;
If you delete this css-row, your menu will work:
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #5BC8C3;
position: fixed;
top: 60px;
width: 100%;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: #f7f7f7;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #F7f7f7;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #284A64;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: #f7f7f7;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f7f7f7
}
.dropdown:hover .dropdown-content {
display: block;
}
<ul>
<li><a class="active" href="#index">Home</a>
</li>
<li>Catalog
</li>
<li>Calendar
</li>
<li class="dropdown">
Library Information
<div class="dropdown-content">
Children's Programs
Adult Programs
Help Services
Other Services
Library Policies
</div>
</li>
<li>Contact
</li>
</ul>
ul{
margin:0px;
padding:0px;
list-style:none;
}
ul li{
background-color:#5BC8C3;
width:150px;
height:50px;
float:left;
line-height:50px;
color:#0FC;
text-align:center;
}
ul li a{
color: #FFF;
text-decoration:none;
display:block;
}
ul li a:hover{
background-color:#F7f7f7;
}
<ul>
<li>Home</li>
<li>Catalog</li>
<li>Calender</li>
<li>Library Information
<ul>
<li>Children's Programs</li>
<li>Adult Programs</li>
<li>Help Services</li>
</ul>
</li>
<li>Contact</li>
</ul>