<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS Menu - Horizontal</title>
<style type="text/css">
ul#navmenu {
margin: 0;
border: 0 none;
padding: 0;
width:790px; /*For KHTML*/
list-style: none;
height:30px;
background:#f90;
}
ul#navmenu li {
margin: 0;
border: 0 none;
padding: 0;
float: left; /*For Gecko*/
display: inline;
list-style: none;
position: relative;
height:30px;
background:url(images/navborder.jpg) no-repeat right center;
}
ul#navmenu ul {
margin: 0;
border: 0 none;
padding: 0;
width: 160px;
list-style: none;
display: none;
position: absolute;
top:30px;
left: 0;
}
ul#navmenu ul li {
float: none; /*For Gecko*/
display: block !important;
display: inline; /*For IE*/
height:30px;
line-height:30px;
}
/* Root Menu */
ul#navmenu a {
padding: 0 6px;
float: none !important; /*For Opera*/
float: left; /*For IE*/
display: block;
color: #fff;
font: bold 10px Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
height: auto !important;
height: 1%; /*For IE*/
line-height:30px;
}
/* Root Menu Hover Persistence */
ul#navmenu a:hover,
ul#navmenu li:hover a,
ul#navmenu li.iehover a {
margin:0px;
color: #F60;
}
/* 2nd Menu */
ul#navmenu li:hover li a,
ul#navmenu li.iehover li a {
float: none;
background: #c3e5fe;
color: #333;
display:block;
border:solid 1px #fff;
height:30px;
line-height:30px;
}
/* 2nd Menu Hover Persistence */
ul#navmenu li:hover li a:hover,
ul#navmenu li:hover li:hover a,
ul#navmenu li.iehover li a:hover,
ul#navmenu li.iehover li.iehover a {
background: #76b6e4;
color: #FFF;
height:30px;
line-height:30px;
}
/* 3rd Menu */
ul#navmenu li:hover li:hover li a,
ul#navmenu li.iehover li.iehover li a {
background: #c3e5fe;
color: #666;
height:30px;
line-height:30px;
}
/* 3rd Menu Hover Persistence */
ul#navmenu li:hover li:hover li a:hover,
ul#navmenu li:hover li:hover li:hover a,
ul#navmenu li.iehover li.iehover li a:hover,
ul#navmenu li.iehover li.iehover li.iehover a {
background: #76b6e4;
color: #FFF;
height:30px;
line-height:30px;
margin:0px;
}
ul#navmenu ul ul,
ul#navmenu ul ul ul {
display: none;
position: absolute;
top: 0;
left: 160px;
}
/* Do Not Move - Must Come Before display:block for Gecko */
ul#navmenu li:hover ul ul,
ul#navmenu li:hover ul ul ul,
ul#navmenu li.iehover ul ul,
ul#navmenu li.iehover ul ul ul {
display: none;
}
ul#navmenu li:hover ul,
ul#navmenu ul li:hover ul,
ul#navmenu ul ul li:hover ul,
ul#navmenu li.iehover ul,
ul#navmenu ul li.iehover ul,
ul#navmenu ul ul li.iehover ul {
display: block;
}
</style>
<script type="text/JavaScript">
navHover = function() {
var lis = document.getElementById("navmenu").getElementsByTagName("LI");
for (var i=0; i<lis.length; i++) {
lis[i].onmouseover=function() {
this.className+=" iehover";
}
lis[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" iehover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
</script>
</head>
<body>
<ul id="navmenu">
<li><a href="#">Home</a></li>
<li><a href="#">Maldives at a Glance</a>
<ul>
<li><a href="#">General Information</a>
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Economy</a></li>
<li><a href="#">Government</a></li>
</ul>
</li>
<li><a href="#">General Information</a> </li>
</ul>
</li>
<li><a href="#">About the Embassy</a>
<ul>
<li><a href="#">About Us</a>
<ul>
<li><a href="#">CV of Ambassador</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">International Relations</a>
<ul>
<li><a href="#">Maldives
来源:https://www.cnblogs.com/jcomet/archive/2008/07/14/1242837.html