-3

I have a menu that I have built that is currently working fine, I am trying to add sub menu items that appear when the mouse hovers over a menu item. Does anyone know how to do this?

<div id="menu">
            <a  href="#" >Home</a>
            <a  href="#">Submit New Record</a>
            <a   href="#">Sales by Salesperson</a>
            <a   href="#">Total Sales</a>
            <a  href="#" >Sales by Issue</a>
            <a  href="#" >Sales by Ad Size</a> 
            <a  href="#" >Add New User</a>  
            <a href="#">Edit Record</a> 
            <a href="#">Logout</a>
            </div></center>
<style>
#menu{
background-color:#3F9AD1;
height:75px;
width:1206px;
}

#menu a{
border-style:solid;
border-width:2px;
border-color:white;
padding-top: 20px;
float:left;
display:block;
width:130px;
height:70px;
text-decoration:none;
color:white;
text-align:center;
font-family: Arial;
/*box-shadow: 0 -7px 22px 6px #000000 inset;*/
}

#menu a:hover{
    color:#3F9AD1;
    background-color:white;

#html { 
height: 100%; 
margin-bottom: 0.01em;
overflow-y: scroll;
}

</style>
  • Have you tried anything at all? (Helpful links for asking better questions: [ask], [FAQ]) – tckmn Apr 08 '13 at 20:59
  • 1
    Have you googled anything? "html5 hover menu" gives about 2,000,000 hits, this one looks nice: http://jacwright.github.io/simpli5/demos/hover-menu.html – regretoverflow Apr 08 '13 at 21:01

2 Answers2

3

I normally do that like this:

<ul class="menu">
    <li>Main Menu Item
        <ul class="submenu">
            <li>Sub Menu Item</li>
        </ul>
    </li>
</ul>

Then the css like this:

ul.submenu {
    display: none;
}

li:hover ul.submenu {
    display: block;
}
Jake Zeitz
  • 2,285
  • 3
  • 20
  • 36
1

You can go here and learn using their sample tutorial. It's quite easy. Just deals with you hover state.

http://line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu

OmniPotens
  • 1,109
  • 11
  • 29