老师的案例自己的案例没有做出来

原创 2018-11-13 15:14:09 166
摘要:<!DOCTYPE html> <html> <head>     <meta charset="UTF-8" />     <title>这是CSS导航</title>   &
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>这是CSS导航</title>
    <link rel="shortcut icon" type="image/x-icon" href="images/logo1.png" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
</head>
<body>
<div class="header">
    <div class="header_content">
        <div class="header_left">
            <a href="" class="">中国大陆 <i class="fa fa-angle-down"></i></a>
            <a href="" style="color:#ff5000;">亲,请登录</a>
            <a href="">免费注册</a>
            <a href="">手机逛淘宝</a>
        </div>
        <div class="header_right">
            <a href="" class="header_a">我的淘宝 <i class="fa fa-angle-down"></i>
                <ul>
                    <li>买到的宝贝</li>
                    <li>我的足迹</li>

                </ul>
            </a>
            <a href="" class="header_a" style="color:#ff5000;"><i class="fa fa-cart-plus"></i> 购物车</a>
            <a href="" class="header_a"><span class="fa fa-star"></span> 收藏夹 </a>
            <a href="" class="header_a"> 商品分类 </a>
            <a href="" class="header_a">卖家中心 <span class="fa fa-angle-down"></span></a>
            <a href="" class="header_a">联系客服 <span class="fa fa-angle-down"></span></a>
            <a href="" class="header_a" style="color:#ff5000;">网站导航 <span class="fa fa-align-justify"></span></a>
        </div>

    </div>
</div>
</body>
</html>
*{margin:0px;padding:0px;}
li{list-style: none;}
a{text-decoration: none;color: #6c6c6c;font-size: 13px;}
.clear{clear:both;}
.header{width:100%;background-color:#f5f5f5;}
.header_content{width:1200px;margin:0px auto;line-height:40px;}
.header_left{height:40px;float:left;}
.header_right{height:48px; float:right;}
.header_left a{display:inline-block;height:40px;text-align: center;position:relative;padding:0px 2px;}
.header_content a:hover{color:ff5000;}
.header_right{height:40px;float:right;}
.header_a{display:inline-block;height:40px;text-align:center;width:90px;position:relative;}
.header_a:hover{background-color:#fff;}
.header_a ul{border:1px solid #f5f5f5;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 3px;margin:3px 0px;}
.header_a ul li:hover{background-color:#f5f5f5;}

我在.header_a:hover ul{display:block;position:absolute;width:100px;}这里面加上margin-top:5px;就选不中li列表中的元素了,这是为什么呢?我是想让下拉列表与上面点击内容有一部分间隔。

批改老师:韦小宝批改时间:2018-11-13 15:20:11
老师总结:不错啊!写的很完整!课后还得多多练习!继续加油吧!!!

发布手记

热门词条