設(shè)計(jì)
- header盒子必須有高度
<header class="header w">
</header>
.header {
height: 105px;
background-color: pink;
}
- 1號盒子是logo標(biāo)志定位
這里會用到LOGO SEO優(yōu)化
<div class="logo">
<h1>
<a href="index.html" title="品優(yōu)購商城">品優(yōu)購商城</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="語言開發(fā)">
<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">優(yōu)惠購首發(fā)</a>
<a href="#">億元優(yōu)惠</a>
<a href="#">9.9元團(tuán)購</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 統(tǒng)計(jì)部分用絕對定位做
- count統(tǒng)計(jì)部分不要給寬度耀找,因?yàn)榭赡苜I的件數(shù)比較多,讓件數(shù)撐開就好了业崖,給一個(gè)高度
- 一定注意左下角不是圓角野芒,其余三個(gè)是圓角,寫法 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;
}