摘要:<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>仿淘宝</title> <link rel="stylesheet" type="text/css" href="index.c
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>仿淘宝</title>
<link rel="stylesheet" type="text/css" href="index.css"/>
<link rel="stylesheet" type="text/css" href="font/css/font-awesome.min.css"/>
</head>
<body>
<!--头部导航条-->
<div class="header">
<div class="header_content">
<!--左边内容-->
<div class="header_left">
<a href="" class="header_a">中国大陆 <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=""><span class="fa fa-cart-plus" style="color: #FF5000;"></span> 购物车</a>
<a href="" class="header_a"><span class="fa fa-star"></span> 收藏夹<i class="fa fa-angle-down"></i></a>
<a href="">商品分类</a>
<a href="" class="header_a">卖家中心<i class="fa fa-angle-down"></i></a>
<a href="" class="header_a">联系客服<i class="fa fa-angle-down"></i></a>
<a href="" class="header_a"><span class="fa fa-align-justify" style="color: #FF5000;"></span> 网站导航<i class="fa fa-angle-down"></i></a>
</div>
<!--样式清楚div-->
<div class="clear"></div>
</div>
</div>
</body>
</html>
CSS样式
*{
margin: 0px;
padding: 0px;
}
a{
text-decoration: none;
color: #6c6c6c;
font-size: 13px;
}
li{
list-style: none;
}
/*清除浮动*/
.clear{
clear: both;/*清楚所有浮动样式*/
}
/*头部导航条*/
.header{
width: 100%;
height: 35px;
background-color: #F5F5F5;
}
.header_content{
width: 1200px;
height: 35px;
margin: 0px auto;
/*border: 1px solid red;*/
line-height: 35px;/*控制垂直居中*/
}
.header_left{
/*width: 300px;*/
height: 40px;
/*background-color: pink;*/
float: left;
}
.header_content a:hover{
color: red;
}
.header_left a{
margin-right: 5px;
}
.header_right{
width: 600px;
height: 35px;
/*background-color: pink;*/
float:right
}
.header_a{
display: inline-block;
height: 35px;
width: 90px;
/*background-color:red ;*/
text-align: center;
position: relative;/*相对定位,不设置的话,列表内容会跟随隐藏内容的显示而更换位置*/
}
.header_a:hover{
background-color: #FFFFFF;
}
.header_a ul{
border: 1px solid #F5F5F5;
display: none;
border-top: none;
}
.header_a ul li{
color: #6C6C6C;
height: 30px;
line-height: 30px;
text-align: left;/*左对齐*/
padding: 0px 3px;
margin: 5px 0px;
}
.header_a:hover ul{
display: block;
position: absolute;/*绝对定位*/
width: 100px;
}
.header_a ul li:hover{
background-color: #F5F5F5;
}
批改老师:灭绝师太批改时间:2018-11-11 18:01:16
老师总结:带有下拉菜单的布局可以选用无序列表嵌套,继续加油!