gnolan
04-27-2011, 12:52 PM
Hi,
I'm new to CSS HTML and am looking to create a horizontal drop-down menu solely from HTML and CSS if possible. I have read an article on "A List Apart" but am still stuck. The following is the HTML and CSS i've got so far.
<div id="nav">
<ul>
<li><a href="testproject.html">HOME</a></li>|
<li><a href="about.html">ABOUT ME</a></li>|
<li><a href="nutritional_health.html">NUTRITIONAL HEALTH</a>|
<ul>
<li><a href="nutritional_health.html#whatis">» What it is</a></li>
<li><a href="nutritional_health.html#how">» How it can help you</a></li>
</ul>
</li>
<li><a href="recipes.html">RECIPES</a></li>|
<li><a href="pricing.html">PRICING</a></li>|
<li><a href="contact.html">CONTACT</a></li>
</ul>
</div>
#nav {
margin: 0px;
padding: 0px;
width: 800px;
height: 40px;
text-align: center;
font-size :15pt;
font-family: sylfaen, verdana, arial-narrow;
font-weight: normal;
background-image: url('images/bg_navbar.jpg');
border-bottom: 10px solid #CCCCCC;
}
#nav ul {
list-style: none;
display: inline;
margin: 0px;
padding: 0px;
}
#nav ul li {
display: inline;
padding: 0px 3px 0px 3px;
}
#nav ul li a {
text-decoration: none;
}
#nav ul li a:link {
color: #FFFFFF;
}
#nav ul li a:visited {
color: #555555;
}
#nav ul li a:hover, #nav ul li a:active {
border-bottom: 4px solid #008500;
}
#nav ul li ul {
display: none;
position: absolute;
}
#nav ul li ul:hover {
display: block
}
Right now no sub-menu is showing due to the "display:none" but i am also not seeing anything when hovering over the main link. I would appreciate any help.
I'm new to CSS HTML and am looking to create a horizontal drop-down menu solely from HTML and CSS if possible. I have read an article on "A List Apart" but am still stuck. The following is the HTML and CSS i've got so far.
<div id="nav">
<ul>
<li><a href="testproject.html">HOME</a></li>|
<li><a href="about.html">ABOUT ME</a></li>|
<li><a href="nutritional_health.html">NUTRITIONAL HEALTH</a>|
<ul>
<li><a href="nutritional_health.html#whatis">» What it is</a></li>
<li><a href="nutritional_health.html#how">» How it can help you</a></li>
</ul>
</li>
<li><a href="recipes.html">RECIPES</a></li>|
<li><a href="pricing.html">PRICING</a></li>|
<li><a href="contact.html">CONTACT</a></li>
</ul>
</div>
#nav {
margin: 0px;
padding: 0px;
width: 800px;
height: 40px;
text-align: center;
font-size :15pt;
font-family: sylfaen, verdana, arial-narrow;
font-weight: normal;
background-image: url('images/bg_navbar.jpg');
border-bottom: 10px solid #CCCCCC;
}
#nav ul {
list-style: none;
display: inline;
margin: 0px;
padding: 0px;
}
#nav ul li {
display: inline;
padding: 0px 3px 0px 3px;
}
#nav ul li a {
text-decoration: none;
}
#nav ul li a:link {
color: #FFFFFF;
}
#nav ul li a:visited {
color: #555555;
}
#nav ul li a:hover, #nav ul li a:active {
border-bottom: 4px solid #008500;
}
#nav ul li ul {
display: none;
position: absolute;
}
#nav ul li ul:hover {
display: block
}
Right now no sub-menu is showing due to the "display:none" but i am also not seeing anything when hovering over the main link. I would appreciate any help.