设计
- header盒子必须有高度
<header class="header w">
</header>
.header {
height: 105px;
background-color: pink;
}
- 1号盒子是logo标志定位
这里会用到LOGO SEO优化
<div class="logo">
<h1>
<a href="index.html" title="品优购商城">品优购商城</a>
</h1>
</div>
.logo {
position: absolute;
top: 25px;
width: 171px;
height: 61px;
background-color: skyblue;
}
.logo a {
display: block;
width: 171px;
height: 61px;
/* 京东 */
/* font-size: 0; */
/* 淘宝 */
text-indent: -9999px;
overflow: hidden;
background: url(../images/logo.png) no-repeat;
}
- 2号盒子是search搜索模块定位
<div class="search">
<input type="search" placeholder="语言开发">
<button>搜索</button>
</div>
.search {
position: absolute;
top: 35px;
left: 346px;
width: 538px;
height: 36px;
border: 2px solid #b1191a;
}
.search input {
float: left;
padding-left: 10px;
height: 32px;
width: 454px;
}
.search button {
float: left;
width: 80px;
height: 32px;
font-size: 16px;
color: #fff;
background-color: #b1191a;
}
- 3号盒子是hotwords热词模块定位
<div class="hotwords">
<a href="#" class="style_red">优惠购首发</a>
<a href="#">亿元优惠</a>
<a href="#">9.9元团购</a>
<a href="#">每满99减30</a>
<a href="#">办公用品</a>
<a href="#">电脑</a>
<a href="#">通信</a>
</div>
.hotwords {
position: absolute;
top: 66px;
left: 346px;
}
.hotwords a {
margin: 0 10px;
}
- 4号盒子是shopcar购物车模块
- content 统计部分用绝对定位做
- count统计部分不要给宽度,因为可能买的件数比较多,让件数撑开就好了,给一个高度
- 一定注意左下角不是圆角,其余三个是圆角,写法 border-radius: 7px 7px 7px 0;
<div class="shopcar">
我的购物车
<i class="count">99</i>
</div>
.shopcar::before {
margin-right: 5px;
content: '\e93a';
color: #b1191a;
font-family: icomoon;
}
.shopcar::after {
content: '\e905';
font-family: icomoon;
margin-left: 5px;
}
.count {
position: absolute;
top: -5px;
left: 105px;
/* right: 20px; */
padding: 0 5px;
height: 14px;
line-height: 14px;
color: #fff;
background-color: #b1191a;
border-radius: 7px 7px 7px 0;
}