<html><head><title>Dynamic Drive DHTML Scripts- Chrome CSS Drop Down Menu</title><script language="JavaScript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script><style type="text/css">
.chromestyle{
width: 99%;
font-weight: bold;
}
.chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.chromestyle ul{
border: 1px solid #BBB;
width: 100%;
background: url(chromebg.gif) center center repeat-x; /*THEME CHANGE HERE*/
padding: 4px 0;
margin: 0;
text-align: left; /*set value to "left", "center", or "right"*/
}
.chromestyle ul li{
display: inline;
}
.chromestyle ul li a{
color: #494949;
padding: 4px 7px;
margin: 0;
text-decoration: none;
border-right: 1px solid #DADADA;
}
.chromestyle ul li a:hover, .chromestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/
background: url(chromebg-over.gif) center center repeat-x; /*THEME CHANGE HERE*/
}
/* ######### Style for Drop Down Menu ######### */
dropmenudiv{
position:absolute;
top: 0px;
border: 1px solid #BBB; /*THEME CHANGE HERE*/
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
background-color: white;
width: 200px;
visibility: hidden;
}
.dropmenudiv a{
width: auto; /*Set the dropdown length*/
display: block;
text-indent: 3px;
border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/
padding: 2px 0;
text-decoration: none;
font-weight: bold;
color: black;
}
.dropmenudiv a:hover{ /*THEME CHANGE HERE*/
background-color: #F0F0F0;
}
</style></head><body><div><div class="chromestyle" id="chromemenu"><ul><li><a href="#">Home</a></li><li><a href="#" rel="dropmenu1" onMouseOver="setVisibility('dropmenu1', 'inline');" onMouseOut="setVisibility('dropmenu1','none');">Setting <img src="images/down.gif" border="0" /></a></li><li><a href="#" onMouseOver="setVisibility('dropmenu2', 'inline');" onMouseOut="setVisibility('dropmenu2','none');">Profile <img src="images/down.gif" border="0" /></a></li></ul></div><!--1st drop down menu --><div id="dropmenu1" class="dropmenudiv"><a href="#">Marks Setting</a><a href="#">Course Setting</a><a href="#">Subject Setting</a></div><div id="dropmenu2" class="dropmenudiv"><a href="#">Add Profile</a><a href="#">View Profile</a></div></div></body></html>
This is the sample code that I done. It's works.
But, when I run the code, by default the drop down menu is displayed.
The drop down menu suppose be displayed when I mouse over it.
What should I do to overcome it?
Last edited by Nico; 09-25-08 at 02:13 AM.
Reason: Wrappers.