2.6 main 主体模块制作
HTML:
<div class="w">
<div class="main">
<!-- 焦点图模块 -->
<div class="focus">
<ul>
<li><img src="./images/banner_bg.png" alt=""></li>
</ul>
</div>
<!-- 新闻快报模块 -->
<div class="newdflash">
<!-- 新闻模块 -->
<div class="news">
<!-- 新闻头部模块 -->
<div class="news-hd">
<h5>品优购快报</h5>
<a href="#" class="more">更多</a>
</div>
<!-- 新闻主题部分 -->
<div class="news-bd">
<ul>
<li><a href="#"><strong>[特惠】</strong>备战开学季 全民半价购数码</a></li>
<li><a href="#"><strong>[公告】</strong>品优稳占家电网购六成份额</a></li>
<li><a href="#"><strong>[特惠】</strong>百元中秋全品类礼券限里领</a></li>
<li><a href="#"><strong>[公告】</strong>上品优生鲜 享阳澄湖大闸蟹</a></li>
<li><a href="#"><strong>[特惠】</strong>每日享折扣品优 品质游</a></li>
</ul>
</div>
</div>
<!-- 生活服务模块 -->
<div class="lifeservice">
<ul>
<li>
<i></i>
<p>花费</p>
</li>
<li>
<em><a>减</a></em>
<i></i>
<p>飞机</p>
</li>
<li>
<i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
<li><i></i>
<p>花费</p>
</li>
</ul>
</div>
<!-- 特价商品 -->
<div class="bargin">
<img src="./images/ad.jpg" alt="">
</div>
</div>
</div>
</div>
CSS
/* 声明字体图标 */
@font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?tomleg');
src: url('../fonts/icomoon.eot?tomleg#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?tomleg') format('truetype'),
url('../fonts/icomoon.woff?tomleg') format('woff'),
url('../fonts/icomoon.svg?tomleg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
.main {
width: 980px;
height: 455px;
margin-left: 220px;
/* background-color: darkblue; */
}
.focus {
width: 721px;
height: 455px;
float: left;
background-color: red;
margin-right: 8px;
}
.newsflash {
float: right;
width: 250px;
height: 455px;
background-color: firebrick;
}
/* 新闻快报模块 */
.news {
height: 165px;
border: 1px solid #e4e4e4;
margin-left: 5px;
/* background-color: firebrick; */
}
.news-hd {
height: 33px;
border-bottom: 1px dotted #e4e4e4;
line-height: 33px;
padding: 0 15px;
}
.news-hd h5 {
float: left;
font-size: 14px;
}
.news-hd .more {
float: right;
}
.news-hd .more::after {
font-family: 'icomoon';
content: '\e920';
}
.news-bd {
padding: 5px 15px 0;
}
.news-bd ul li {
height: 24px;
line-height: 24px;
overflow: hidden;
white-space: nowrap;
/* 超出部分省略号显示 */
text-overflow: ellipsis;
}
/* 生活服务模块 */
.lifeservice {
overflow: hidden;
height: 209px;
/* background-color: rgb(238, 247, 71); */
border: 1px solid #e4e4e4;
border-top: 0;
}
.lifeservice ul {
width: 252px;
}
.lifeservice ul li {
position: relative;
float: left;
width: 62px;
height: 70px;
border-right: 1px solid #e4e4e4;
border-bottom: 1px solid #e4e4e4;
text-align: center;
}
.lifeservice ul li i {
display: inline-block;
width: 24px;
height: 28px;
background: url(../images/icons.png) no-repeat -19px -15px;
margin-top: 12px;
}
.lifeservice ul li em {
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
/* background-color: darkcyan; */
border: 10px solid darkcyan;
border-top: 18px solid darkcyan;
border-bottom-color: transparent;
text-align: center;
}
.lifeservice ul li em a {
position: absolute;
color: #fff;
top: -18px;
left: -6px;
}
/* 特价商品 */
.bargin {
margin-top: 4px;
}
2.7 推荐模块制作
HTML
<!-- 推荐模块制作 -->
<div class="w recom">
<div class="recom_hd">
<img src="../shopping/images/clock.png" alt="">
<p>今日推荐</p>
</div>
<div class="recom_db">
<ul>
<li><img src="./images/recommend01.png" alt=""></li>
<li><img src="./images/recommend01.png" alt=""></li>
<li><img src="./images/recommend01.png" alt=""></li>
<li><img src="./images/recommend01.png" alt=""></li>
</ul>
</div>
</div>
CSS
/* 推荐模块制作 */
.recom {
height: 163px;
margin-top: 12px;
background-color: #ebebeb;
}
.recom_hd {
float: left;
width: 206px;
height: 163px;
background-color: #5c5251;
text-align: center;
}
.recom_hd img {
padding-top: 30px;
}
.recom_hd p {
font-size: 18px;
color: #ffffff;
margin-top: 10px;
}
.recom_db {
float: left;
}
.recom_db ul li {
position: relative;
float: left;
}
.recom_db ul li img {
width: 248px;
height: 163px;
}
/* :nth-child(-n+3) 从第三个往前面选 */
.recom_db ul li:nth-child(-n+3):after {
content: "";
position: absolute;
right: 0;
top: 10px;
width: 1px;
height: 145px;
background-color: #ddd;
}