目录
banner-图
效果图:
index.html:
<!-- banner -->
<div class="banner">
<div class="wrapper">
<!-- 有多少张图,就放多少个li -->
<ul>
<li><a href="#"><img src="./uploads/banner_1.png" alt=""></a></li>
</ul>
</div>
</div>
index.css:
.banner{
height: 500px;
background-color: #f5f5f5;
}
.banner .wrapper{
height: 500px;
background-color: pink;
}
banner-侧导航-布局
效果图:
index.html:
<!-- 侧导航 -->
<div class="aside">
<ul>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
</ul>
</div>
index.css:
/* 侧导航 */
.banner .aside{
position: absolute;
left: 0;
top: 0;
width: 250px;
height: 500px;
background-color: rgba(0,0,0,0.8);
}
.banner .aside li{
height: 50px;
line-height: 50px;
}
.banner .aside a{
/* 宽度和父级一样 */
display: block;
padding-left: 36px;
padding-right: 19px;
width: 250px;
height: 50px;
background-color: pink;
}
banner-侧导航-内容
效果图:
index.html:
<!-- 侧导航 -->
<div class="aside">
<ul>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
<li><a href="#">生鲜<span>水果 蔬菜</span></a></li>
</ul>
</div>
index.css:
.banner .aside a{
position: relative;
/* 宽度和父级一样 */
padding-left: 36px;
padding-right: 19px;
display: block;
height: 50px;
/* background-color: pink; */
color: #fff;
}
.bannner .aside span{
margin-left: 15px;
font-size: 14px;
}
.banner .aside a:hover{
color: #27ba9b;
}
/* 在a的里面的最后的位置添加箭头 */
.banner .aside a::after{
position: absolute;
right: 19px;
top: 19px;
content: '';
width: 6px;
height: 11px;
background-image: url(../images/sprites.png);
background-position: -80px -110px;
background-color: green;
}
banner-箭头
效果图:
html:
<!-- 箭头 -->
<!-- prev:上一个 -->
<a href="#" class="prev"></a>
<!-- next:下一个 -->
<a href="" class="next"></a>
css:
/* 箭头 */
.prev,
.next{
position: absolute;
top: 228px;
width: 45px;
height: 45px;
background-color: rgba(0,0,0,.2);
background-image: url(../images/sprites.png);
border-radius: 50%;
}
/* 背景图位置负责两件事:改变箭头在盒子里的位置;改变精灵图的位置 */
/* 导致在精灵图中测量不准确 */
/* 解决方案:1.书写背景图位置属性,借助谷歌调试工具调试具体的位置数值
2.书写标签的时候,a负责盒子,span负责图案
*/
.prev{
left: 260px;
background-position: 14px -60px;
}
.next{
right: 10px;
background-position: -24px -60px;
}
banner-圆点
效果图:
html:
<!-- 圆点:当前状态:current/active -->
<!-- js找到用户当前的li 添加类名 li变成白色的 -->
<ol>
<li></li>
<li></li>
<li class="current"></li>
<li></li>
<li></li>
</ol>
css:
/* 圆点 */
.banner ol{
position: absolute;
left: 680px;
bottom: 30px;
/* width: 200px; */
height: 10px;
/* background-color: pink; */
}
.banner ol li{
float: left;
margin-right: 24px;
width: 10px;
height: 10px;
background-color: rgba(255,255,255,0.4);
border-radius: 50%;
cursor: pointer;
}
.banner ol .current{
background-color: #fff;
}
新鲜好物-标题
效果图:
html:
<!-- 新鲜好物 -->
<div class="goods wrapper">
<!-- hd header,头部 -->
<div class="hd">
<h2>新鲜好物<span>新鲜出炉 品质靠谱</span></h2>
<a href="#">查看全部</a>
</div>
<!--body 身体,内容 -->
<div class="bd"></div>
</div>
css:
/* 新鲜好物 */
.goods .hd{
height: 114px;
/* background-color: pink; */
line-height: 114px;
}
.goods .hd h2{
float: left;
font-size: 29px;
font-weight: 400;
height: 114px;
}
.goods .hd h2 span{
margin-left: 34px;
font-size: 16px;
color:#999;
}
.goods .hd a{
float: right;
color: #999;
}
.goods .hd a::after{
display: inline-block;
margin-left: 13px;
content: '';
width: 7px;
height: 13px;
/* background-color: green; */
background-image: url(../images/sprites.png);
background-position: 0 -110px;
}
新鲜好物-内容-布局
效果图:
html:
<!--body 身体,内容 -->
<div class="bd clearfix">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
css:
/* 新鲜好物 */
.goods .hd{
height: 114px;
/* background-color: pink; */
line-height: 114px;
}
.goods .hd h2{
float: left;
font-size: 29px;
font-weight: 400;
height: 114px;
}
.goods .hd h2 span{
margin-left: 34px;
font-size: 16px;
color:#999;
}
.goods .hd a{
float: right;
color: #999;
}
.goods .hd a::after{
display: inline-block;
margin-left: 13px;
content: '';
width: 7px;
height: 13px;
/* background-color: green; */
background-image: url(../images/sprites.png);
background-position: 0 -110px;
}
.goods .bd li{
margin-right: 8px;
float: left;
width: 304px;
height: 405px;
background-color: #f0f9f4;
}
.goods .bd li:last-child{
margin-right: 0;
}
新鲜好物-内容完成
效果图:
html:
<!--body 身体,内容 -->
<div class="bd clearfix">
<ul>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
</li>
</ul>
</div>
css:
.goods .bd li img{
width: 304px;
}
.goods .bd li h3{
margin-top: 20px;
margin-bottom: 10px;
font-size: 20px;
font-weight: 400;
}
.goods .bd li div{
color: #9a2e1f;
font-size: 17px;
}
.goods .bd li span{
font-size: 23px;
}
新鲜好物-新品文字
效果图:
html:
<ul>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
<b>新品</b>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
<b>新品</b>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
<b>新品</b>
</li>
<li>
<img src="./uploads/new_goods_1.jpg" alt="">
<h3>睿米无线吸尘器F8</h3>
<div>¥ <span>899</span></div>
<b>新品</b>
</li>
</ul>
css:
.goods .bd li b{
position: absolute;
left: 17px;
top: 18px;
width: 28px;
height: 51px;
border: 1px solid #27ba9b;
border-radius: 2px;
font-size: 18px;
color: #27ba9b;
font-weight: 400;
line-height: 24px;
}
生鲜标题-布局
效果图:
html:
<!-- 生鲜 -->
<div class="shengxian wrapper">
<div class="hd">
<h2>生鲜</h2>
<a href="#" class="more">查看全部</a>
<ul>
<li><a href="#">水果</a></li>
</ul>
</div>
<div class="bd"></div>
</div>
css:
/* 生鲜 */
.shengxian .hd{
height: 96px;
background-color: pink;
line-height: 96px;
}
.shengxian .hd h2{
float: left;
}
.shengxian .hd .more{
float: right;
}
.shengxian .hd ul{
float: right;
}
生鲜区域
生鲜图:
html:
<!-- 生鲜 -->
<div class="shengxian wrapper">
<div class="hd">
<h2>生鲜</h2>
<a href="#" class="more">查看全部</a>
<ul>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">水果</a></li>
</ul>
</div>
<div class="bd"></div>
</div>
css:
.goods .hd a,
.shengxian .hd .more{
float: right;
color: #999;
}
.goods .hd a::after,
.shengxian .hd .more::after{
display: inline-block;
margin-left: 13px;
content: '';
width: 7px;
height: 13px;
/* background-color: green; */
background-image: url(../images/sprites.png);
background-position: 0 -110px;
}
.shengxian .hd ul{
float: right;
margin-right: 65px;
}
.shengxian .hd ul li{
float: left;
}
.shengxian .hd li a{
padding: 2px 7px;
margin-left: 6px;
}
.shengxian .hd li a:hover{
background-color:#27ba9b;
color: #fff;
}
生鲜-内容-布局
效果图:
html:
<div class="bd clearfix">
<div class="left">
<a href="#"><img src="./uploads/fresh_goods_cover.png" alt=""></a>
</div>
<div class="right"></div>
</div>
css:
.shengxian .bd .left{
float: left;
width: 240px;
height: 610px;
background-color: pink;
}
.shengxian .bd .right{
float: right;
width: 1000px;
height: 610px;
background-color: skyblue;
}