head
HTML部分:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/head.css"/>
</head>
<body>
<div class="head">
<!-- div.line$*3 -->
<div class="line1">
<span class="log">
<img src="../img/logo/yinLogo.png" >
</span>
<ul>
<li><a href="#">官方微博</a></li>
<li><a href="#">关注微信</a></li>
<li><a href="rading.html">购物须知</a></li>
</ul>
</div>
<div class="line2">
<!-- span.log+span.search+ul>li*3 -->
<span class="log">
<img src="../img/logo/shop-logo-v1.png" >
</span>
<div>
<input type="text" class="search"/></input>
<span class="btn"></span>
</div>
<ul>
<li>
<img class="login" src="../img/icon/avatar.png"></img>
<a href="#">
</a>登录</li>
<li><a href="#"></a>我的订单</li>
<li>
<img class="cart" src="../img/icon/cart-logo-v1.png"></img>
<a href="buy.html"></a>购物车</li>
</ul>
</div>
<hr />
<div class="line3">
<!-- span.title+ul>(li>a[href=#]{首页})*8 -->
<span class="title"><a href="#">艺人分类</a></span>
<ul>
<li><a href="index.html" class="active">首页</a></li>
<li><a href="list.html">专辑</a></li>
<li><a href="index.html">明星周边</a></li>
<li><a href="index.html">明星同款</a></li>
<li><a href="index.html">个护美妆</a></li>
<li><a href="index.html">影漫周边</a></li>
<li><a href="index.html">食品</a></li>
<li><a href="index.html">服装配饰</a></li>
</ul>
</div>
</div>
</body>
</html>
CSS部分:
body{
margin: 0;
}
.head{
background-color:#222;
}
.head ul{
padding-left: 0;
}
.head ul li{
display: inline-block;
}
.head a{
text-decoration: none;
color: white;
display: block;
}
.head .line1{
line-height: 16px;
background-color: #000;
display: flex;
justify-content: space-between;/* 中间全空 两边对齐 */
align-items: center;/* 居中对齐 */
}
.head .line1 .log{
margin-left: 120px;
}
.head .line1 ul{
margin-right: 120px;
}
.head .line1 li{
width: 120px;
text-align: center;
border-right: 1px solid #999;
}
.head .line1 li a{
color: #999999;
}
.head .line1 li:last-child{
border: none;
}
.head .line2{
width: 1000px;
margin: 0 auto;
display: flex;
justify-content: space-between;/* 中间全空 两边对齐 */
align-items: center;/* 居中对齐 */
}
.head .line2 div{
position: relative;
}
.head .line2 .search{
display: inline-block;
width: 435px;
height: 40px;
border: none;
outline: none;
background: url(../img/icon/search_icon.png);
background-position: 0 -43px;
color: #FFFFFF;
font-size: 16px;
padding-left: 16px;
}
.head .line2 .btn{
display: inline-block;
height: 40px;
width: 32px;
/* background-color: white; */
position: absolute;
background: url(../img/icon/search_icon.png);
background-position: -454px 0px;
right: 18px;
}
.head .line2 .search:focus{
background-position: 0 1px;
color: #333333;
}
.head .line2 .btn:focus+.btn{
background-position: 456px -42px;
}
.head .line2 ul{
margin-right: -89px;
}
.head .line2 li{
margin: 0 15px;
color: #FFFFFF;
}
.head .line2 li a{
display: inline-block;
}
.head .line2 li img{
display: inline-block;
vertical-align: middle;
height: 20px;
width: 20px;
margin-right: 5px;
margin-top: -3px;
}
.head hr{
border: none;
border-bottom: 1px solid #999999;
margin-bottom: 0;/* margin-bottom 底部距离 */
}
.head .line3{
width: 1000px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.head .line3 .title a{
display: block;
background-color: #000000;
line-height: 51px;
width: 94px;
text-align: center;
margin-left: -7px;
}
.head .line3 ul{
margin: 0;
}
.head .line3 li{
width: 90px;
text-align: center;
line-height: 51px;
}
.head .line3 li a:hover{
color: #DE4767;
border-bottom: 3px solid #DE4767;
line-height: 45px;
}
.head .line3 .active{
color: #DE4767;
border-bottom: 3px solid #DE4767;
line-height: 45px;
}