摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>下拉菜單效果實現(xiàn)</title> &
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>下拉菜單效果實現(xiàn)</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來實現(xiàn)下拉菜單還是蠻簡單的 總的來說要比js來實現(xiàn)簡單多了