My current code presents an issue where hovering over "About Us" opens all the dropdown menus below. How can I modify the CSS so that each menu only appears when individually moused over? For example, when hovering over "Team," only the menus under it should be visible.
Additionally, I would like to adjust the width of the menu to shift it more towards the left.
Another problem arises when a dropdown menu is lengthy, causing it to hide beneath other content on the page. I want the dropdown menu to appear above the rest of the page's content instead of being hidden.
Thank you in advance for your help!
<style>
ul {
font-family: Arial, Verdana;
font-size: 14px;
margin: 0;
padding: 0;
list-style: none;
}
ul li {
display: block;
position: relative;
float: left;
}
li ul { display: none; }
ul li a {
display: block;
text-decoration: none;
color: #ffffff;
border-top: 1px solid #ffffff;
padding: 5px 15px 5px 15px;
background: #000061;
margin-left: 1px;
white-space: nowrap;
}
ul li a:hover { background: #617F8A; }
li:hover ul {
display: block;
position: absolute;
}
ul li:hover li {
float: none;
font-size: 11px;
}
li:hover a { background: #617F8A; }
li:hover li a:hover { background: #95A9B1; }
</style>
<body>
<ul id="menu">
<li><a href=""><b>Home</b></a></li>
<li><a href=""><b>About Us</b></a>
<ul>
<li><a href="">Team</a>
<ul>
<li><a href="">Profile</a></li>
<li><a href="">Board</a></li>
</ul>
</li>
</ul>
</li>
<ul>
</body>
JSFiddle: http://jsfiddle.net/LWEry/