实现效果:
html代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="小兔鲜儿官网,致力于打造全球最大的食品、生鲜电商购物平台">
<meta name="keywords" content="小兔鲜儿,食品,生鲜,服装,家电,电商,购物">
<title>小兔鲜儿</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./css/base.css">
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/index.css">
</head>
<body>
<div class="nav">
<div class="banxin">
<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="#">
<span></span>手机版</a>
</li>
</ul>
</div>
</div>
<div class="nav1 banxin">
<div class="num1"></div>
<div class="num2">
<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>
<li>
<a href="#">孕婴</a>
</li>
<li>
<a href="#">服装</a>
</li>
</ul>
</div>
<div class="num3"><span></span><input type="text" placeholder="搜一搜">
</div>
<div class="num4"><span></span></div>
</div>
<div class="nav2 banxin">
<div class="num1">
<ul>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
<li>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
<a href="#">
<h5>生鲜</h5><span>水果 蔬菜</span>
<p>></p>
</a>
</li>
</ul>
</div>
<div class="num2"></div>
<div class="num3"></div>
</div>
<div class="nav3 banxin">
<div class="num1">
<h1>新鲜好物</h1>
</div>
<div class="num2"><span>新鲜出炉 本质靠谱</span></div>
<div class="num3">
<a href="#">
查看全部 >
</a>
</div>
</div>
<div class="nav4 banxin">
<ul>
<li>
<a href="#">
<span></span>
<!-- new_goods_1 -->
<h5>瑞米无线吸尘器F8</h5>
<p>¥899</p>
</a>
</li>
<li>
<a href="#">
<span></span>
<!-- new_goods_1 -->
<h5>瑞米无线吸尘器F8</h5>
<p>¥899</p>
</a>
</li>
<li>
<a href="#">
<span></span>
<!-- new_goods_1 -->
<h5>瑞米无线吸尘器F8</h5>
<p>¥899</p>
</a>
</li>
<li>
<a href="#">
<span></span>
<!-- new_goods_1 -->
<h5>瑞米无线吸尘器F8</h5>
<p>¥899</p>
</a>
</li>
</ul>
</div>
<div class="nav5 banxin">
<h5>生鲜</h5>
<a href="#">查看全部 ></a>
<div class="box">
<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>
<div class="nav6 banxin">
<div class="num1"></div>
<div class="num2">
<ul>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
<li>
<a href="#">
<span></span>
<p>小米餐具</p>
<h5>¥9999</h5>
</a>
</li>
</ul>
</div>
</div>
<div class="nav7 ">
<div class="one">
<ul>
<li>
<span></span>
<h5>价格亲民</h5>
</li>
<li>
<span></span>
<h5>物流快捷</h5>
</li>
<li>
<span></span>
<h5>品质新鲜</h5>
</li>
</ul>
</div>
<div class="two">
<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="three">
<p>CopyRight@小兔鲜儿</p>
</div>
</div>
</body>
</html>
css代码
.banxin {
width: 1240px;
margin: 0 auto;
}
.nav {
height: 52px;
background-color: #333;
}
.nav .banxin {
height: 52px;
}
.nav .banxin ul {
float: right;
}
.nav .banxin li {
display: inline-block;
line-height: 52px;
}
.nav .banxin li a {
border-right: 1px solid #666666;
color: #dcdcdc;
font-size: 14px;
padding: 0 15px;
}
.nav .banxin li a span {
display: inline-block;
width: 11px;
height: 16px;
background-image: url(../images/sprites.png);
background-position: -160px -70px;
vertical-align: middle;
margin-right: 6px;
}
.nav1 {
height: 70px;
margin-top: 10px;
margin-bottom: 10px;
}
.nav1 .num1 {
float: left;
width: 207px;
height: 70px;
background-image: url(../images/logo.png);
background-size: contain;
}
.nav1 .num2 {
float: left;
height: 70px;
line-height: 70px;
margin-left: 30px;
}
.nav1 .num2 li {
float: left;
}
.nav1 .num2 li a {
line-height: 70px;
margin: 0 22px;
}
.nav1 .num2 li a:hover {
color: green;
border-bottom: 1px solid green;
}
.nav1 .num3 {
float: left;
height: 25px;
margin-left: 153px;
line-height: 70px;
margin-top: 20px;
}
.nav1 .num3 span {
float: left;
display: inline-block;
height: 18px;
width: 18px;
background-image: url(../images/sprites.png);
background-position: -80px -70px;
vertical-align: middle;
margin-right: 5px;
}
.nav1 .num3 input {
float: left;
height: 25px;
width: 100px;
}
.nav1 .num4 {
float: left;
height: 70px;
margin-left: 15px;
}
.nav1 .num4 span {
display: inline-block;
width: 21px;
height: 26px;
background-image: url(../images/sprites.png);
background-position: -121px -70px;
margin-top: 23px;
}
.nav2 {
height: 500px;
background-image: url(../uploads/banner_1.png);
background-size: cover;
}
.nav2 .num1 {
float: left;
width: 300px;
height: 500px;
background-color: rgba(0, 0, 0, .7)
}
.nav2 .num1 li a {
float: left;
display: inline-block;
height: 50px;
width: 300px;
line-height: 50px;
}
.nav2 .num1 li a:hover {
background-color: #27ba9b;
}
.nav2 .num1 li a h5 {
margin-left: 30px;
float: left;
font-weight: 400;
font-size: 16px;
color: #fff;
}
.nav2 .num1 li a span {
margin-left: 16px;
float: left;
font-size: 13px;
color: #fff;
}
.nav2 .num1 li a p {
float: right;
color: #fff;
margin-right: 20px;
}
.nav3 {
margin-top: 10px;
height: 100px;
}
.nav3 .num1 {
float: left;
line-height: 100px;
}
.nav3 .num1 h1 {
/* color: #999999; */
}
.nav3 .num2 {
float: left;
margin-left: 30px;
line-height: 100px;
}
.nav3 .num2 span {
color: #999999;
}
.nav3 .num3 {
float: right;
line-height: 100px;
}
.nav3 .num3 a {
color: #999999;
}
.nav4 {
height: 400px;
}
.nav4 ul li {
float: left;
width: 300px;
display: inline-block;
margin: 0px 5px;
background-color: #f0f9f4;
}
.nav4 ul li a {
width: 300px;
display: inline-block;
}
.nav4 ul li a span {
display: inline-block;
width: 300px;
height: 300px;
background-image: url(../uploads/new_goods_1.jpg);
background-size: cover;
}
.nav4 ul li a h5 {
width: 300px;
display: inline-block;
text-align: center;
padding: 10px 0px;
font-size: 20px;
font-weight: 400;
}
.nav4 ul li a p {
width: 300px;
display: inline-block;
text-align: center;
padding: 10px 0px;
font-size: 16px;
color: red;
}
.nav5 {
height: 100px;
}
.nav5 h5 {
float: left;
display: inline-block;
line-height: 100px;
font-size: 30px;
font-weight: 400;
}
.nav5 a {
float: right;
display: inline-block;
line-height: 100px;
color: #999b9c;
}
.nav5 .box {
float: right;
height: 100px;
margin-right: 100px;
line-height: 100px;
}
.nav5 ul li {
float: left;
}
.nav5 ul li a {
display: inline-block;
font-size: 16px;
color: #333;
margin: 0px 22px;
line-height: 100px;
}
.nav5 ul li a:hover {
color: #27ba9b;
}
.nav6 {
height: 600px;
}
.nav6 .num1 {
float: left;
width: 210px;
height: 600px;
background-image: url(../uploads/fresh_goods_cover.png);
background-size: cover;
}
.nav6 .num2 {
float: left;
width: 1030px;
height: 600px;
}
.nav6 .num2 ul li {
float: right;
width: 237px;
height: 280px;
margin: 10px;
}
.nav6 .num2 ul li a span {
display: inline-block;
width: 237px;
height: 237px;
background-image: url(../uploads/kitchen_goods_1.jpg);
background-size: contain;
}
.nav6 .num2 ul li a p {
text-align: center;
font-size: 15px;
}
.nav6 .num2 ul li a h5 {
text-align: center;
font-weight: 400;
color: red;
}
.nav7 {
height: 390px;
background-color: #333;
}
.nav7 .one {
width: 1302px;
height: 225px;
/* background-color: pink; */
margin: 0 auto;
border-bottom: 1px solid #434343;
}
.nav7 .one ul li {
float: left;
display: inline-block;
height: 58px;
margin: 90px 161px;
}
.nav7 .one ul li span {
float: left;
display: inline-block;
width: 58px;
height: 58px;
background-position: 0px 0px;
background-image: url(../images/sprites.png)
}
.nav7 .one ul li h5 {
float: left;
color: #fff;
line-height: 58px;
}
.nav7 .two {
width: 516px;
height: 65px;
margin: 0 auto;
}
.nav7 .two ul li a {
margin-top: 10px;
float: left;
color: #fff;
}
.nav7 .three {
width: 164px;
height: 31px;
margin: 0 auto;
}
.nav7 .three p {
color: #fff;
}
css清除浮动:
/* 清除默认样式的代码 */
/* 去除常见标签默认的 margin 和 padding */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li,
dl,
dt,
dd,
input {
margin: 0;
padding: 0;
}
/* 內减模式 */
* {
box-sizing: border-box;
}
/* 设置网页统一的字体大小、行高、字体系列相关属性 */
body {
font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
color: #333;
}
/* 去除列表默认样式 */
ul,
ol {
list-style: none;
}
/* 去除默认的倾斜效果 */
em,
i {
font-style: normal;
}
/* 去除a标签默认下划线,并设置默认文字颜色 */
a {
text-decoration: none;
color: #333;
}
/* 设置img的垂直对齐方式为居中对齐,去除img默认下间隙 */
img {
vertical-align: middle;
}
/* 去除input默认样式 */
input {
border: none;
outline: none;
color: #333;
}
/* 左浮动 */
.fl {
float: left;
}
/* 右浮动 */
.fr {
float: right;
}
/* 双伪元素清除法 */
.clearfix::before,
.clearfix::after {
content: "";
display: table;
}
.clearfix::after {
clear: both;
}
目录列表