<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style type = "text/css">
/*设置通配符样式*/
*{
margin:0;
padding:0;
}
body{
font-size:12px;
}
ul{
list-style:none;
}
a{
text-decoration:none;
}
/*设置二级导航样式*/
.nav {
width:500px;
height:30px;
background-color:#b4b4b4;
/*导航栏居中*/
margin:auto;
}
.nav ul li {
width:100px;
height:30px;
float:left;
position:relative;
}
.nav ul li a {
display:block;
width:96px;
border:2px solid gray;
height:26px;
line-height:26px;
text-align:center;
}
.nav ul li a:hover {
background-color:yellow;
}
/*设置一级导航样式*/
.nav ul li ul{
display:none;
}
.nav ul li:hover ul{
display:block;
width:100px;
position:absolute;
top:30px;
left:0;
background-color:white;
}
.nav ul li:hover ul li a{
display:block;
width:96px;
height:26px;
line-height:26px;
border:2px solid gray;
text-align:center;
}
.nav ul li:hover ul li a:hover{
background-color:orange;
}
/*设置三级导航样式*/
.nav ul li:hover ul li ul {
display:none;
}
.nav ul li:hover ul li:hover ul{
display:block;
width:100px;
position:absolute;
top:0px;
left:100px;
background-color:#b4b4b4;
}
.nav ul li:hover ul li:hover ul li {
width:100px;
height:30px;
}
.nav ul li:hover ul li:hover ul li a {
display:block;
width:96px;
height:26px;
line-height:26px;
border:2px solid gray;
text-align:center;
}
.nav ul li:hover ul li:hover ul li a:hover {
background-color:#00CC00;
}
.nav ul li:hover ul .nav_jw ul {
display:none;
}
.nav ul li:hover ul .nav_jw:hover ul{
display:block;
width:100px;
position:absolute;
top:0px;
left:-100px;
background-color:#b4b4b4;
}
.nav ul li:hover ul .nav_jw:hover ul li {
width:100px;
height:30px;
}
.nav ul li:hover ul .nav_jw:hover ul li a {
display:block;
width:96px;
height:26px;
line-height:26px;
border:2px solid gray;
text-align:center;
}
.nav ul li:hover ul .nav_jw:hover ul li a:hover {
background-color:#00CC00;
}
</style>
<meta charset="gb2312">
</head>
<body>
<div class = "nav">
<ul>
<li><a href = "#">一级导航</a>
<ul>
<li><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
<li><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
<li><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
</ul>
</li>
<li><a href = "#">一级导航</a>
<ul>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
</ul>
</li>
<li><a href = "#">一级导航</a>
<ul>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
</ul>
</li>
<li><a href = "#">一级导航</a>
<ul>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
<li><a href = "#">二级导航</a></li>
</ul>
</li>
<li><a href = "#">一级导航</a>
<ul>
<li class="nav_jw"><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
<li class="nav_jw"><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
<li class="nav_jw"><a href = "#">二级导航</a>
<ul>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
<li><a href = "#">三级导航</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.test1 li{
position:relative;
float:left;
width:100px;
height:20px;
text-align:center;
border:1px solid #000;
cursor:pointer;
}
.test1 li:hover .test2{
display:block;
}
.test2{
display:none;
position: absolute;
top: 21px;
left: -41px;
}
li{
list-style: none;
}
</style>
</head>
<body>
<div class="daohang">
<ul class="test1">
<li>
<span>number1</span>
<ul class="test2">
<li>选项1</li>
<li>选项2</li>
<li>选项3</li>
</ul>
</li>
<li>
<span>number2</span>
<ul class="test2">
<li>选项1</li>
<li>选项2</li>
<li>选项3</li>
</ul>
</li>
<li>
<span>number3</span>
<ul class="test2">
<li>选项1</li>
<li>选项2</li>
<li>选项3</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" mrc="text/html; charset=utf-8" />
<title>下拉导航条</title>
<style type="text/css">
* {
margin:0;
padding:0;
}
body {
font-family:Arail;
font-size:15px;
}
.nav {
margin:20px;
}
.nav ul ul {
display:none;
}
.nav ul li {
float:left;
position:relative;
width:80px;
text-align:center;
}
.nav li a {
display:block;
color:white;
text-decoration:none;
background:#000;
padding:10px;
font-size:15px;
}
.nav li a:hover {
color:#ffffff;
background:#003399;
}
.nav ul li:hover ul {
display:block;
position:absolute;
top:38px;
left:0px;
}
ul {
list-style-type:none;
}
.nav li ul li a {
margin-top:0;
background:red;
color:#000;
}
.nav li ul li a:hover {
color:#FFF;
background:#000;
}
</style>
</head>
<body>
<div class="nav">
<ul>
<li><a href="#">源码下载</a>
<ul>
<li><a href="/">CodeFans</a></li>
<li><a href="#">banana</a></li>
</ul>
</li>
<li><a href="#">网站首页</a>
<ul>
<li><a href="#">CodeFans</a></li>
<li><a href="#">cattle</a></li>
</ul>
</li>
<li><a href="#">ASP</a>
<ul>
<li><a href="#">ASP</a></li>
<li><a href="#">cattle</a></li>
</ul>
</li>
<li><a href="#">PHP</a>
<ul>
<li><a href="/">AJAX</a></li>
<li><a href="#">dog</a></li>
</ul>
</li>
<li><a href="#">ASP.NET</a>
<ul>
<li><a href="#">ASP</a></li>
<li><a href="#">cattle</a></li>
<li><a href="/">dog</a></li>
</ul>
</li>
<li><a href="#">AJAX</a>
<ul>
<li><a href="#">MOOTS</a></li>
<li><a href="#">DOTS</a></li>
</ul>
</li>
<li><a href="#">JQUERY</a>
<ul>
<li><a href="#">JAVA</a></li>
<li><a href="/">cattle</a></li>
<li><a href="/">EXTS</a></li>
<li><a href="#">cat</a></li>
</ul>
</li>
<li><a href="#">CHINA</a>
<ul>
<li><a href="#">CHINA</a></li>
<li><a href="#">PHP</a></li>
</ul>
</li>
<li><a href="#">USA</a>
<ul>
<li><a href="/">USA</a></li>
<li><a href="/">cattle</a></li>
<li><a href="#">chicken</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
满意采纳哦,谢谢
带下拉菜单的要用到JS,先给你一个简单的导航菜单吧!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#nav{ width:1000px; height:41px; background:url(images/menu2.jpg) -219px 0px;}
#nav ul{ list-style:none; margin:0px; padding:0px;}
#nav ul li{ float:left;}
#nav ul li a{ color:#FFFFFF; display:block; width:125px; height:41px; text-align:center; text-decoration:none; line-height:41px;}
#nav ul li a:hover{ background:url(images/menu1.jpg);}
</style>
</head>
<body>
<div id="nav">
<ul>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
<li><a href="#">网站首页</a></li>
</ul>
</div>
</body>
</html>
menu2.jpg是一个背景图片,menu1.jpg是鼠标经过的图片