I am working on a simple css drop down menu, when I hover the list, the drop down displays, but when my mouse move beyond the “#head” wrapper div the list closes.
the head div is wraps the menu and my logo and a search bar.
The content div wraps all my contents.
When there is content below the “head” div, say another “content” div, then the drop down list displays until i move the cursor beyond the “head” div
div#content{
display:block;
width:972;
float:none;
position:relative;
}
#top_menu{
float:right;
text-align: left;
width: 505px;
padding: 5px 0 0 0;
display: inline-block;
}
#top_menu ul{
list-style-type:none;
float:right;
}
#top_menu ul li ul{
display:none;
}
#top_menu ul li{
float: left;
padding: 0 0 0 14px;
margin: 0;
width: auto;
}
#top_menu ul li:hover ul{
display:block;
position:absolute;
}
#top_menu ul li:hover ul li{
clear: left;
}
#top_menu a{
display:block;
}
<div id="head">
<div id = "top_menu">
<ul class="nav">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a>
<ul>
<li><a href="1.php">1</a></li>
<li><a href="2.php">2</a></li>
<li><a href="3.php">3</a></li>
<li><a href="4.php">4</a></li>
<li><a href="5.php">5</a></li>
<li><a href="6.php">6</a></li>
</ul>
</li>
</ul>
</div>
<div class="clear"></div>
<div class="search">
<form action="search.php" method="post">
<input type="text" maxlength="30" width="40" />
<input type="submit" value="submit" />
</form>
</div>
</div>
ok… i fixed it by adding a z-index, turns out the content div, which is attached below the head div, is covering up the drop down box. so in the css, i just added: z-index:1000, then it worked. thanks all.