仿京东静态网站制作之首页焦点图和快报模块
一、首页焦点图focus制作
主要知识点:圆角边框&定位
HTML结构
<div class="focus">
<ul>
<li><img src="./upload/focus.png" alt=""></li>
</ul>
<div class="dotted">
<li></li>
<li></li>
<li></li>
<li></li>
</div>
</div>
说明:因为在实际使用中,焦点图(轮播图)肯定不止一张,所以这里将图片包含在li里面
CSS代码
.main {
margin-left: 220px;
margin-top: 10px;
width: 980px;
height: 455px;
}
.main .focus {
position: relative;
float: left;
width: 721px;
height: 455px;
}
.focus .dotted {
position: absolute;
left: 321.5px;
bottom: 10px;
height: 20px;
width: 78px;
border-radius: 10px;
border: 2px solid #fff;
}
.main .focus li {
float: left;
width: 12px;
height: 12px;
border-radius: 5px;
border: 1px solid #666;
margin: 3px 3px 0;
}
.focus li:nth-child(2) {
background-color: #fff;
}
效果展示

二、首页快报模块newsflash制作
主要知识点:浮动&精灵图&结构伪类选择器
HTML结构
<div class="newsflash">
<div class="news">
<dt class="dt">
<h5>品优购快报</h5>
<a href="#">更多 </a>
</dt>
<dd class="dd"><a href="#"><strong>[特惠]</strong>备战开学季 全民半价购数码</a></dd>
<dd class="dd"><a href="#"><strong>[公告]</strong>品优购稳占家电网购六成份额</a></dd>
<dd class="dd"><a href="#"><strong>[特惠]</strong>百元中秋全品类礼券限量领</a></dd>
<dd class="dd"><a href="#"><strong>[公告]</strong>上品优生鲜 享阳澄湖大闸蟹</a></dd>
<dd class="dd"><a href="#"><strong>[特惠]</strong>每日享折扣品优品质游</a></dd>
</div>
<div class="lifeservice">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="bargain"><img src="./upload/bargain.png" alt=""></div>
</div>
将整个快报模块又分成了三份:news、lifeservice、bargain
CSS代码
/* 首页快报模块newflash */
.main .newsflash {
float: right;
width: 250px;
}
/* news部分 */
.newsflash .news {
height: 165px;
border: 1px solid #e4e4e4;
}
.news .dt {
border-bottom: 1px #e4e4e4 dotted;
height: 34px;
line-height: 34px;
}
.news h5 {
float: left;
margin-left: 10px;
font-weight: 400;
font-size: 16px;
}
.news .dt a {
float: right;
margin-right: 10px;
}
.news a::after {
content: '\e903';
font-family: 'icomoon';
}
.news .dd {
margin: 7px 10px;
}
/* lifeservice部分 */
.lifeservice {
width: 250px;
height: 210px;
border-left: 1px solid #e4e4e4;
}
.lifeservice li {
float: left;
width: 25%;
height: 70px;
border-right: 1px solid #e4e4e4;
border-bottom: 1px solid #e4e4e4;
}
.lifeservice li:nth-child(1) {
background: url(../images/lifeservices.png) 0 0;
}
.lifeservice li:nth-child(2) {
background: url(../images/lifeservices.png) -62px 0;
}
.lifeservice li:nth-child(3) {
background: url(../images/lifeservices.png) -123px 0;
}
.lifeservice li:nth-child(4) {
background: url(../images/lifeservices.png) -188px 0;
}
.lifeservice li:nth-child(5) {
background: url(../images/lifeservices.png) 0 -72px;
}
.lifeservice li:nth-child(6) {
background: url(../images/lifeservices.png) -62px -72px;
}
.lifeservice li:nth-child(7) {
background: url(../images/lifeservices.png) -123px -72px;
}
.lifeservice li:nth-child(8) {
background: url(../images/lifeservices.png) -188px -72px;
}
.lifeservice li:nth-child(9) {
background: url(../images/lifeservices.png) 0 -139px;
}
.lifeservice li:nth-child(10) {
background: url(../images/lifeservices.png) -62px -139px;
}
.lifeservice li:nth-child(11) {
background: url(../images/lifeservices.png) -123px -139px;
}
.lifeservice li:nth-child(12) {
background: url(../images/lifeservices.png) -188px -139px;
}
/* bargain部分 */
.bargain {
margin-top: 10px;
}
精灵图即将多个图标集成在一张图片上,极大地减少向服务器请求的次数,非常实用
效果展示

到目前为止静态网站的效果Fighting

小本在学习ing:心若向阳,何必惆怅。
浙公网安备 33010602011771号