html+css简单下拉菜单制作

额,今天心血来潮做了个简单的下拉菜单,不过用的css操作的,啧!

最终效果:








































































代码:

<!DOCTYPE html>
<html>
<head>
	<title>DaoHang</title>
	<meta charset="utf-8">
	<style type="text/css">
		*{margin:0px; padding: 0px; }
		#dh{
			position: relative;
			margin-top: 0px;
			width: 400px;
			height:40px;
			border: 0px;
			background-color: #0099CC;
		}
		#dh ul{
			padding: 0px;
			
		}
		a{
			color: #FFF;
			width: 100px;
			height: 40px;
			display: block;
			text-decoration: none;
			text-align: center;
			line-height: 40px;
			font-family: Microsoft Yahei;
			font-weight: 2px;
		}
		#dh {
			margin:0px auto; 
		}
		#dh ul li {
			list-style: none;
			float: left;
		}
		#dh ul li a:hover{
			background-color: #6699FF;
		}
		#dh ul:hover{
			display: block;
		}
		#dh ul li ul{
			background-color: #0099CC;
			position: absolute;
			display: none;
		}
		#dh ul li ul li{
			float: none;
			background-color: #6688EE;
			
		}
		#dh ul li ul li a{
			font-size: 13px;
			font-weight: 0px;
		}
		#dh ul li:hover ul{             /*二级菜单的触发点*/
			display: block;
		}
	</style>
</head>
<body>
	<div id="dh">
		<ul>
			<li><a href="#">首页</a></li>
			<li><a href="#">课程内容</a>
					<ul>
						<li><a href="#">Java</a></li>
						<li><a href="#">Javascript</a></li>
						<li><a href="#">HTML</a></li>
					</ul>
				</li>
			<li><a href="#">实验内容</a>
					<ul>
						<li><a href="#">Java试验1</a></li>
						<li><a href="#">Java试验2</a></li>
						<li><a href="#">Java试验3</a></li>
					</ul>
				</li>
			<li><a href="#">关于我们</a>
					<ul>
						<li><a href="#">网站历史</a></li>
						<li><a href="#">联系方式</a></li>
					</ul>
				</li>
		</ul>
	</div>
</body>
</html>


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值