摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>下拉菜单效果实现</title> &
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>下拉菜单效果实现</title>
<style type="text/css">
*{margin: 0px;padding: 0px;}
.clear{clear: both;}
a{text-decoration: none;color: #6C6C6C;font-size:11px;float: left;}
.header{width:200px;height:40px;margin: 0px auto;line-height: 40px;background-color: pink;}
.header_a{display: inline-block;height: 40px;width: 100px;text-align: center;}
.header_a:hover{background-color: #fff;}
.header_a ul li:hover{background-color: pink;}
.header_a ul{border: 1px solid pink; display: none; border-top: none;}
.header_a:hover ul{display: block;position: absolute;width: 100px;}
.header_a ul li{color: #6C6C6C;height: 30px;line-height: 30px;text-align: left;padding: 0px 20px;margin:10px 0px;}
li{list-style: none;}
</style>
</head>
<body>
<div class="header">
<a href="" class="header_a">我的菜单1#
<ul>
<li>水果</li>
<li>水果</li>
</ul>
</a>
<a href="" class="header_a">我的菜单2#
<ul>
<li>水果</li>
<li>水果</li>
</ul>
</a>
</a>
<div class="clear"></div>
</div>
</body>
</html>还要多多练习。
批改老师:韦小宝批改时间:2019-03-11 09:08:31
老师总结:写的很不错 css来实现下拉菜单还是蛮简单的 总的来说要比js来实现简单多了