下拉菜单总结

Original 2019-01-27 22:23:35 220
abstract:总结:1.下拉列表,需要用到绝对定位,脱离文档流,使其不影响其它布局。2.鼠标移上,列表展开。用到hover听到过有人说:好的前端工程师都是设计师。感觉自己不会做太多前端的东西,主要还是攻一下后端吧。代码:HTML:<!DOCTYPE html><html><head>    <title>淘宝导航</t

总结:

1.下拉列表,需要用到绝对定位,脱离文档流,使其不影响其它布局。

2.鼠标移上,列表展开。用到hover

听到过有人说:好的前端工程师都是设计师。

感觉自己不会做太多前端的东西,主要还是攻一下后端吧。

代码:

HTML:

<!DOCTYPE html>

<html>

<head>

    <title>淘宝导航</title>

    <link rel="stylesheet" type="text/css" href="css/style.css">

    <link rel="stylesheet" type="text/css" href="css/font-awesome-4.7.0/css/font-awesome.min.css">

</head>

<body>

    <div class="header">

        <div class="content">

            <div class="contentLeft">

                <a href="" class="content_a">中国大陆&nbsp;&nbsp; <i class=" fa fa-angle-down"></i></a>

                <a href="" style="color:#ff5000">亲,请登陆</a>

                <a href="">免费注册</a>

                <a href="">手机逛淘宝</a>

            </div>

            <div class="contentRight">

                <a href="" class="content_a">我的淘宝&nbsp;&nbsp; <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>&nbsp;购物车&nbsp;&nbsp; <i class=" fa fa-angle-down"></i></a>

                <a href="" class="content_a"> <span class="fa fa-star"></span>&nbsp;收藏夹&nbsp;&nbsp; <i class=" fa fa-angle-down"></i>

                    <ul>

                        <li>收藏的宝贝</li>

                        <li>收藏的店铺</li>

                    </ul>

                </a>

                <a href="">商品分类</a>

                <a href="" class="content_a">卖家中心&nbsp;&nbsp; <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="" class="content_a">联系客服&nbsp;&nbsp; <i class=" fa fa-angle-down"></i>

                    <ul>

                        <li>消费者客服</li>

                        <li>卖家客服</li>

                    </ul>

                </a>

                <a href="" class="content_a" style="color:#ff5000">网站导航&nbsp;&nbsp; <i class=" fa fa-angle-down"></i></a>

            </div>

        </div>

        

        <div class="clear"></div>

    </div>

</body>

</html>

CSS:

*{margin: 0px; padding: 0px;}

a{text-decoration: none; color: #000; font-size: 13px; }

li{list-style: none;}

.header{ width: 100%; height: 40px; background-color: #f5f5f5; }

.content{ width: 1200px; margin: 0px auto;line-height: 40px; }

.contentLeft{ height: 40px; float: left; }

.contentLeft a{

margin-right: 5px;

}

.contentLeft a:hover{

color: #ff5000;


}

.contentRight{  height: 40px;  float: right; }

.contentRight a{

margin-right: 5px;

}

.clear{ clear:both; }

.content_a{

display: inline-block;

height: 40px;

width: 90px;

text-align: center;

position: relative;

}

.content_a:hover{

background-color: #fff;

color: #ff5000;

}

.content_a ul{

border: 1px solid #f5f5f5;

border-top: none;


display:none;

position: absolute;

}

.content_a:hover ul{

display: block;

width:100px;

}  

.content_a ul li{

color: #6c6c6c;

height: 30px;

line-height: 30px;

text-align: left;

padding: 0px 3px;

margin: 5px 0px;

}

.content_a ul li:hover{

background: #f5f5f5;

}


Correcting teacher:灭绝师太Correction time:2019-01-28 09:16:01
Teacher's summary:能用机会成为全栈,为何要选择呢,不管是学习的哪一个阶段都全力以赴吧

Release Notes

Popular Entries