0

Check out the JSFiddel Here

I have a CSS Based dropdown menu that drops down on hover but all lists displayed on hover are in the same location, not under the menu item they are associated with. I believe the problem lies with this part of the code...

#menu ul li {
}

but even when I edit this and take away the float I can't seem to figure it out. Maybe someone can point out the mistake I've made. Thanks in advance for the help.

CSS

#menu ul {
font-family: Arial, Verdana;
font-size: 14px;
margin: 0;
padding: 0;
list-style: none;
}
#menu li {
display: inline;
}
#menu ul li {
display: block;
position: relative;
float: left;
}
#menu li ul {
display: none;
}
#menu ul li a {
display: block;
text-decoration: none;
color: #ffffff;
border-top: 1px solid #ffffff;
padding: 5px 15px 5px 15px;
background: #1e7c9a;
margin-left: 1px;
white-space: nowrap;
}
#menu ul li a:hover {
background: #3b3b3b;
}
#menu li:hover ul {
display: block;
position: absolute;
}
#menu li:hover li {
float: none;
font-size: 11px;
}
#menu li:hover a { background: #3b3b3b; }
#menu li:hover li a:hover {
background: #1e7c9a;
}

HTML

<ul id="menu">
<li><a href="#">Find Us</a>
<ul>
<li><a href="#">Web Design</a></li>
<li><a href="#">Graphic Design</a></li>
<li><a href="#">Logo Design</a></li>
<li><a href="#">Blog Design</a></li>
</ul>
</li>
<li><a href="#">Our Menu</a>
<ul>
<li><a href="#">This is a project</a></li>
<li><a href="#">So is this</a></li>
<li><a href="#">and this</a></li>
<li><a href="#">don't forget this too</a></li>
</ul>
</li>
<li><a href="#">Our Story</a>
<ul>
<li><a href="#">Support</a></li>
<li><a href="#">Quote</a></li>
<li><a href="#">General Enquiry</a></li>
</ul>
</li>
</ul>
3
  • Maybe it's better to put this into jsfiddle? Commented Jul 12, 2013 at 14:41
  • 2
    For LI, either use inline-block or float:left. Commented Jul 12, 2013 at 14:41
  • Baldrs the JSfiddle link is at the top of the post. @Diodeus thanks! That worked! Commented Jul 12, 2013 at 14:43

1 Answer 1

6

http://jsfiddle.net/UfpCm/1/

Use inline-block on #menu li.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Andrew, it's always the small things that get you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.