搜索

下拉菜单效果的一些小知识点

原创 2019-03-10 21:48:21 315
摘要:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>头部导航栏</title><link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesom

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>头部导航栏</title>

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

<link rel="stylesheet" href="css/1.css">

</head>

<body>

<div class="header">

    <div class="header-center">

            <div class="header-left">

                <a href=""><i class="fa fa-home"></i>&nbsp;天猫首页</a>

                <p>喵,欢迎来天猫</p>

                <a href="">请登录</a>

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

            </div>

            <div class="header-right">

                <a href="">我的淘宝&nbsp;<i class="fa fa-caret-down"></i>

                    <ul>

                     <li>已买到的宝贝</li>

                     <li>已卖出的宝贝</li>

                    </ul>

                </a>

                <a href=""><i class="fa fa-heart"></i>&nbsp;我关注的品牌</a>

                <a href=""><i class="fa fa-shopping-cart"></i>&nbsp;购物车</a>

                <a href="">收藏夹&nbsp;<i class="fa fa-caret-down"></i>

                    <ul>

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

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

                    </ul>

                </a>

                <a href="">|&nbsp;淘宝网</a>

                <a href="">企业购</a>

                <a href="" style="color:#9c9c9c;"><i class="fa fa-th-list"></i>&nbsp;网站导航&nbsp;<i class="fa fa-caret-down"></i>

                    <ul>

                     <li>已买到的宝贝</li>

                     <li>已卖出的宝贝</li>

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

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

                    </ul>

                </a>

            </div>

        </div>

</div>

</body>

</html>


//css部分:

*{

margin:0;

padding:0;

}

a{

text-decoration:none;

color:#9C9C9C;

font-size:14px;

line-height:30px;

margin-left:15px;

}

a:hover{

color:#D55959;

text-decoration:underline;

}

.fa-home,.fa-heart,.fa-shopping-cart,.fa-th-list{

color:#D55959;

}

p{

display:inline;

color:#9C9C9C;

font-size:14px;

line-height:30px;

margin-left:15px;

}

ul li{

list-style:none;

}

.header{

width:100%;

height:30px;

background:#F2F2F2;

}

.header-center{

width:1350px;

margin:0px auto;

}

.header-left{

height:30px;

float:left;

}

.header-right{

height:30px;

float:right;

}

.header-a{

display:inline-block;

height:30px;

width:90px;

text-align:center;

position:relative;

}

.header-a:hover{

background:#fff;

}

.header-a ul{

border:1px solid #F2F2F2;

display:none;

border-top:none;

}

.header-a:hover ul{

display:block;

position:absolute;

width:100px;

}

.header-a ul li{

color:#9c9c9c;

height:30px;

line-height:30px;

text-align:left;

list-style:none;

margin-left:8px;

}

.header-a ul li:hover{

color:#D55959;

text-decoration:underline;

}

总结:下拉菜单效果的实线相对于头部的布局来说还是有点难的,但上课认真听讲,布局细心认真细心点也是可以做好的!

批改老师:韦小宝批改时间:2019-03-11 09:08:25
老师总结:写的很不错 css来实现下拉菜单还是蛮简单的 总的来说要比js来实现简单多了

发布手记

热门词条