制作一套完整电商页面(包含登陆页面、商品展示页、购物车、支付订单、个人中心等),至少三个页面
淘宝登录页面
分析布局:
具体代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>仿淘宝登录页面</title>
<style>
*{
/* 减小导航栏和总页面的间隔 */
margin: 0px;
}
.content{
width: 1260px;
height: 650px;
background-color: #f3f3f3;
}
.body1{
margin-top: -5px;
background-color: #f3f3f3;
width: 1260px;
height: 80px;
}
.body2{
/* 定义为弹性盒子 使俩个板块并列排布 */
display: flex;
width: 800px;
height: 550px;
/* 调整间距 */
padding-top: 10px;
margin-left: 220px;
/* 调整边框弧度 */
border-radius: 30px;
border: 1px solid white;
background-color: white;
}
.item1{
margin-left: 90px;
}
.bp1{
margin-left: 40px;
margin-top: 80px;
}
/* 在三级标题中间添加竖杠 */
h3 {
display: inline; /* 使得两个h2元素在同一行显示 */
margin-right: 15px; /* 调整标题间距 */
}
h3::after {
content: '|'; /* 添加竖杠 */
margin-left: 15px; /* 调整竖杠与后面标题的距离 */
}
h3:last-child::after {
content: ''; /* 最后一个标题后不加竖杠 */
}
.bp2{
margin-left: -15px;
width: 300px;
margin-top: 45px;
text-align: center;
}
.bp2 p{
margin: 15px;
color: black;
}
.bp2 input{
width: 250px;
height: 40px;
}
.bp2 button{
background-color: lightsalmon;
width: 200px;
height: 40px;
}
.bp3{
margin-left: -30px;
margin-top: 80px;
}
.item2{
/* 设置文字居中 */
text-align: center;
margin-left: 120px;
margin-top: 85px;
}
</style>
</head>
<body>
<div>
<!-- 引入logo -->
<img src="./淘宝登陆页面.png" width="1260px" height="75px">
</div>
<div class="content">
<!-- 制作核心内容 -->
<div class="body1"></div>
<!-- 设置卡片内容 -->
<div class="body2">
<!-- 左边板块 -->
<div class="item1">
<div class="bp1">
<h3>密码登录</h3><h3>短信登录</h3>
</div>
<div class="bp2">
<p><input type="text" name="username" placeholder="帐号名/邮箱/手机号"></p>
<p><input type="text" name="password" placeholder="请输入登录密码"></p>
<button>登录</button>
</div>
<!-- 左边板块尾部 -->
<div class="bp3">
<a href="#">支付宝登录</a> <a href="">免费注册</a> <a href="">忘记账号名</a> <a href="">忘记密码</a>
</div>
</div>
<!-- 右边板块 -->
<div class="item2">
<p><b>手机扫码安全登录</b></p><br>
<img src="./二维码.png" width="200px" height="200px">
</div>
</div>
</div>
</body>
</html>
运行结果
淘宝商品展示页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>仿淘宝页面</title>
<style>
*{
margin-top: 0px;
}
.dh1{
width: 1190px;
height: 30px;
background-color: rgb(216, 216, 216);
}
.dh1,li{
display: inline-block;
list-style: none;
margin-top: 5px;
font-size: 15px;
padding-left: 15px;
}
.search{
display: inline-block;
}
.search,.search-bp{
width: 900px;
height: 100px;
margin-top: 20px;
margin-left: 180px;
}
.text{
margin-left: -30px;
border: 2px solid red;
width: 450px;
height: 30px;
}
.red{
color: red;
}
.A{
color: rgb(177, 177, 177);
}
.submit{
width: 100px;
height: 40px;
background-color: red;
}
.search,a{
text-indent: 30px;
}
.container li{
width: 235px;
height:350px;
list-style-type: none;
display: inline-block;
border: 1px solid black;
position: relative;
}
.container a{
text-decoration: none;
}
.container img{
margin-top: 10px;
float: left;
width: 220px;
height: 235px;
text-align: center;
}
.pro-introduce{
font-family: "PingFangSC-Regular";
font-size: 15px;
color: #9b9b9b;
line-height: 20px;
padding-top: 10px;
text-indent: 10px;
}
.pro-price{
text-indent: -10px;
color: red;
font-size: 15px;
line-height: 30px;
}
.pro-boss{
color: #9b9b9b;
font-size: 9px;
line-height: 20px;
text-indent: -10px;
}
.pro-sale{
color: #9b9b9b;
font-size: 9px;
text-align: right;
margin-right: 2px;
}
</style>
</head>
<body>
<div class="dh1">
<ul>
<li ><select name="address" >
<option value="china">中国大陆</option>
<option value="tw">中国台湾</option>
<option value="xg">中国香港</option>
<option value="hg">韩国</option>
<option value="mg">美国</option>
</select></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="search">
<div class="search-bp">
<form action="">
<input type="text" class="text" placeholder="朴彩英周边">
<input type="submit" class="submit" value="搜索">
</form><br>
<a class="red">一淘限时抢</a>
<a class="A">口红</a>
<a class="A">洗衣液</a>
<a class="A">女袜</a>
<a class="A">女睡衣</a>
<a class="A">女鞋</a>
<a class="A">运动鞋</a>
<a class="A">Dior</a>
<a class="A">新款女装</a>
<a class="A">zara</a>
<a class="A">女裤</a>
</div>
</div>
<!-- 商品列表展示 -->
<div class="container">
<!-- 所有商品信息 -->
<ul>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+-->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
</ul>
</div>
</body>
</html>
运行结果
淘宝个人中心
分析布局:
具体代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>淘宝个人首页</title>
<style>
/* 减少间隔 */
*{
margin: 0px;
}
/* 头部导航栏 */
.header{
width: 1265px;
height: 30px;
background-color: rgb(216, 216, 216);
}
.header li{
display: inline-block;
list-style: none;
margin-top: 5px;
font-size: 15px;
padding-left: 15px;
}
/* 我的淘宝搜索栏 */
.body{
width: 1265px;
height: 50px;
background-color:coral;
}
.body li{
margin-top: 10px;
display: inline-block;
list-style: none;
color: white;
}
/* 自定义字体 */
@font-face{
font-family: pcy;
src: url(./hanyituantuanyuanyuan.ttf);
}
.text{
font-family:"pcy";
color: white;
font-size: 25px;
}
.body a{
margin-top: 15px;
margin-right: 180px;
float: right;
}
.body input{
width: 250px;
height: 20px;
}
.body button{
background-color: gainsboro;
border: 0px none;
height: 25px;
width: 60px;
}
/* 中间内容 */
.content{
display: flex;
}
/* 左侧导航栏 */
.bp{
margin-top: 25px;
list-style: none;
color: coral;
font-size: 20px;
}
.li1{
margin-top :10px;
list-style: none;
font-size: 15px;
}
/* 中间内容 */
.item2{
margin: 25px 30px;
width: 800px;
height: 700px;
}
.item21 img{
width: 800px;
height: 130px;
}
/* 我的物流栏 */
.item22{
display: flex;
margin-top: 20px;
width: 800px;
height: 50px;
background-color: rgb(215, 228, 229,0.3);
}
.item22 img{
padding-top: 10px;
padding-left: 10px;
width: 30px;
height: 30px;
}
.item22 p{
margin-left: 15px;
margin-top: 15px;
color:rgb(66, 87, 126);
}
/* 商品推荐栏 */
.item23{
margin-top: 15px;
width: 800px;
}
.xh1{
height: 45px;
background-color:rgb(143, 191, 230,0.7);
}
.xh1 p{
padding-top: 10px;
padding-left: 5px;
color:white;
}
.xh1 button{
float: right;
width: 80px;
margin-right: 10px;
margin-top: -18px;
}
.xh2 li{
margin-left: -30px;
margin-right: 20px;
list-style-type: none;
display: inline-block;
}
.xh2 img{
margin-top: 10px;
margin-right: 20px;
width: 240px;
height: 245px;
text-align: center;
}
/* 右边日历 */
.item3{
margin-top: 25px;
}
.rl1{
margin-left: -15px;
text-align: center;
padding-top: 8px;
width: 270px;
height: 30px;
background-color: rgba(78, 172, 83, 0.8);
color: white;
}
.rl2{
margin-left: -15px;
width: 270px;
height: 100px;
padding-top: 2px;
text-align: center;
background-color: rgb(219, 242, 223,0.5);
color: rgb(78, 172, 83);
}
.Y{
font-size: 40px;
}
</style>
</head>
<body>
<div class="header">
<ul>
<li>tb098577178</li>
<li>手机逛淘宝</li>
<li>网页无障碍</li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<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="body">
<ul>
<li class="text">我的淘宝</li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li>首页</li>
<li> </li>
<li> </li>
<li> </li>
<li>账号设置</li>
<a><input type="text"><button>搜索</button></a>
</ul>
</div>
<div class="content">
<div class="item1">
<ul>
<li class="bp">全部功能</li>
<li class="li1">我的购物车</li>
<li class="li1">已买到的宝贝</li>
<li class="li1">购买过的店铺</li>
<li class="li1">我的卡券包</li>
<li class="li1">我的发票</li>
<li class="li1">我的收藏</li>
<li class="li1">评价管理</li>
<li class="li1">退款维权</li>
<li class="li1">我的足迹</li>
</ul>
</div>
<div class="item2">
<div class="item21">
<img src="./淘宝.png">
</div>
<div class="item22">
<img src="./快递车.svg" ><p>我的物流</p>
</div>
<div class="item23">
<div class="xh1">
<p>根据浏览,猜我喜欢</p>
<button>换一组</button>
</div>
<div class="xh2">
<ul>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
<li>
<a href="">
<!-- 1.图片 -->
<div class="pro-img"><img src="./朴彩英.jpg"></div>
<!-- 2.文字说明 -->
<div class="pro-introduce">
<span>BLACKPINK朴彩英rolo专辑R</span>
</div>
<!-- 3.价格 -->
<div class="pro-price"><span>126.51</span></div>
<!-- 4.店铺 -->
<div class="pro-boss"><span>广东</span></div>
<!-- 5.月销3000+ -->
<div class="pro-sale"><span>月销3000+</span></div>
</a>
</li>
</div>
</div>
</div>
<div class="item3">
<div class="rl1">我的日历</div>
<div class="rl2">
<p class="Y">06</p>
<p>星期四</p>
<p>2024 06</p>
</div>
</div>
</div>
</body>
</html>