Css ul display is none when hover display is block

RamonRobben picture RamonRobben · Jan 11, 2014 · Viewed 10.9k times · Source

I'm working on a dropdown box but the only thing that doenst want to work is when I hover over the word Info in the unordered list the dropdownbox is not displayed.

I know I have display:none; in ul style but can you change that to display:block; when hovered over the word info?

HTML Code:

<ul id="Menu">
     <li><a href="Index.html">Home </a></li>
     <li><a href="Info.html">Info </a>
          <ul style="display:none;">
             <li><a href="Index.html">Program</a></li>
             <li><a href="Index.html">Getting Started</a><li>
             <li><a href="Index.html">Credits</a></li>
         </ul>
     </li>
     <li><a href="Community.html">Video </a></li>
     <li><a href="Store.html">server </a></li>
     <li><a href="Profile.html">Profile </a></li>
     <li><a href="Help">Help</a></li>
</ul>

CSS Code:

#Menu {
list-style:none;
font-size:16px;
font-weight:Bold;
padding:14px 0 0;
width:415px;
margin-top:0;
float:left;
margin-left:0;
}

#menu { list-style:none;}
li:hover > ul {display:list-item;}
li ul { margin:0; padding:0; position:absolute;z-index:5;padding-top:6px;}
li { float:left; margin-left:10px; }
li ul li { float:none; margin:0; display:inline;}
li ul li a {display:block; padding:6px 10px; background:#333; white-space:nowrap;}
li { display: list-item; text-align: -webkit-match-parent;}
ul { border:0; font-size:100%; font:inherit;vertical-align:baseline;}

Help in advanced. any help is apreciated :) also post a code not only telling me whats wrong thanks!

Answer

mehdi picture mehdi · Jan 11, 2014

use #Menu before your css class names : DEMO

like: #Menu li:hover > ul {display:list-item;}

NOTIC: css Class names are Case-Sensitive