abstract:下拉菜单的实现,需要与position定位和display相结合来实现,通过display来实现显示和隐藏,通过position来实现下拉菜单所显示的位置。<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>淘宝导航</tit
下拉菜单的实现,需要与position定位和display相结合来实现,通过display来实现显示和隐藏,通过position来实现下拉菜单所显示的位置。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>淘宝导航</title> <link rel="stylesheet" href="css/index.css"> <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css"> </head> <body> <div> <div> <div> <a href="" style="color: #000;">中国大陆 <i class="fa fa-angle-down"></i></a> <a href="" style="color: #ff5000;">亲,请登录</a> <a href="">免费注册</a> <a href="">手机逛淘宝</a> </div> <div> <a href="">我的淘宝 <i class="fa fa-angle-down"></i> <ul> <li>已买到的宝贝</li> <li>我的足迹</li> </ul> </a> <a href=""><span class="fa fa-cart-plus" style="color: #ff5000;"></span> 购物车 <i class="fa fa-angle-down"></i></a></a> <a href=""><span class="fa fa-star"></span> 收藏夹 <i class="fa fa-angle-down"></i> <ul> <li>收藏的宝贝</li> <li>收藏的店铺</li> </ul> </a> <a href="">商品分类</a> <a href="">卖家中心 <i class="fa fa-angle-down"></i> <ul> <li>免费开店</li> <li>已卖出的宝贝</li> <li>出售中的宝贝</li> <li>卖家服务市场</li> <li>卖家培训中心</li> <li>体检中心</li> <li>问商友</li> </ul> </a> <a href="">联系客服 <i class="fa fa-angle-down"></i></a> <a href=""><span class="fa fa-align-justify" style="color: #ff5000;"></span> 网站导航 <i class="fa fa-angle-down"></i></a> </div> </div> <div></div> </div> </body> </html>
* {margin: 0px;padding: 0px;} a {text-decoration: none;color: #6c6c6c;font-size: 13px;} li {list-style: none;} .clear {clear: both;} .header {width: 100%;/*height: 40px;*/background-color: #F5F5F5;} .header_content {width: 1200px;/*height: 40px;*/margin: 0px auto;line-height: 40px;} .header_left {height: 40px;float: left;} .header_left a {margin-right: 5px;} .header_content a:hover {color: #ff5000;} .header_right {height: 40px;float: right;} .header_a {display: inline-block;height: 40px;width: 90px;text-align: center;position: relative;} .header_a:hover {background-color: #fff;} .header_a ul {border: 1px solid #f5f5f5;border-top: none;display: none;position: absolute;width: 100px;} .header_a:hover ul {display: block;} .header_a ul li:hover {background-color: #f5f5f5;} .header_a ul li {color: #6c6c6c;height: 30px;line-height: 30px;text-align: left;padding: 0px 5px;margin: 5px 0px;}
Correcting teacher:天蓬老师Correction time:2018-12-27 17:05:15
Teacher's summary:padding: 0px, 0 不需要加 'px'