Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:一入前端深似海, 布局只是小儿科, 前端脚本才是难点... 咱们现在才刚刚开始热身
本次实战通过组件的形式,实现购物车与结算页面。在这其中我们用到了大量的flex
和少量grid
,有个别页面在写的过程中发现,要是不能对页面模型进行很好的布局拆分的话,使用单一的flex
或grid
感觉代码量是真心的多,所以要想做一个好的前端,对页面布局的合理分析与规划还是十分重要的。
首先,将两个页面拆分出公共部分,也就是后面用到的 公共头部、公共底部,还有公用的“标签重置样式表”。
然后,将两个页面的主体进行拆分为三个部分,分别是“头部”、“商品列表”和“金额结算”,其中结算页会有单独的“邮寄信息”部分,
最后针对不同的组件进行编写,然后整体页面拼装就可以了。
“public_footer”组件,使用了grid
;
“shop_payinfo”组件,其中的内容布局分别使用了flex
和grid
实现布局,代码量的对比很明显;
“shop_cart_list”组件,在整个页面的占比是最大的,我个人是用的flex
进行布局的,但是感觉整个方法有点笨,也许grid
会好一点,静待博友优良的解决方案哦!
后面是实战内容,请各位看官多提意见哦!大家共同成长!
购物车
结算页
为了便于页面重复性内容的利用,我们采用组件式开发,最后针对性的对完成的组件进行合理的拼接和布局,得到我们想要的页面。
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>全站页面头部</title>
<link rel="stylesheet" href="css/public_header.css">
</head>
<body>
<div class="public-header">
<a href="">网站首页</a>
<a href="">专题</a>
<a href="">网站导航</a>
<a href="">二手商品</a>
<a href="">讨论区</a>
<span>
<a href=""><i class="iconfont"></i>登录</a>
<a href="">免费注册</a>
</span>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "public_reset.css";
/*头部*/
.public-header{
height: 44px;
background-color: black;
padding: 0 20px;
/*转化为弹性盒子容器*/
display: flex;
flex-flow: row nowrap;
}
/*统一设置容器下的 a 标签项目*/
.public-header >a{
line-height: 44px;
text-align: center;
padding: 0 10px;
color: #cccccc;
}
.public-header >a:hover{
background-color: #fff;
color: black;
font-weight: bold;
}
/*头部右侧内容 right*/
.public-header >span{
line-height: 44px;
text-align: center;
margin-left: auto;
}
.public-header >span a{
color: #cccccc;
padding: 0 10px;
}
/*设置右侧登录图标*/
.public-header >span a i{
font-size: 16px;
color: #cccccc;
padding-right: 10px;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>公共底部</title>
<link rel="stylesheet" href="css/public_footer.css">
</head>
<body>
<!--页尾版权公共组件-->
<div class="public-footer">
<!--背景色容器-->
<div class="footer-container">
<!--页尾顶部链接-->
<div class="footer-links">
<a href="">简介</a>
<a href="">联系我们</a>
<a href="">招聘信息</a>
<a href="">友情链接</a>
<a href="">用户服务协议</a>
<a href="">隐私权声明</a>
<a href="">法律投诉声明</a>
</div>
<!--页尾左侧 logo-->
<span class="footer-logo">LOGO</span>
<!--页尾版权内容-->
<div class="footer-copyright">
<span>2019 fengniao.com. All rights reserved . 安徽闹着玩有限公司(无聊网)版权所有</span>
<span>皖ICP证150110号 京ICP备14323013号-2 皖公网安备110108024357788号</span>
<span>违法和不良信息举报电话: 0551-1234567 举报邮箱: admin@baidu.com</span>
</div>
<!--公众号二维码-->
<div class="footer-QrCode">
<div class="footer-QrCode-content">
<span>关注公众号</span>
<img class="" src="../../images/erwei-code.png" alt="">
</div>
</div>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "public_reset.css";
/*footer页面样式*/
/*页面参考线
*:not(body){
outline: 1px dashed royalblue;
}*/
/*底部组件背景色-容器*/
.public-footer{
width: 100%;
height: 250px;
background-color: #282c31;
color: #959ba2;
}
/*页尾主体内容 gird 网格*/
.public-footer>.footer-container{
width: 880px;
height: 150px;
margin: 0 auto;
padding-top: 20px;
/*转换为Grid网格布局*/
display: grid;
grid-template-columns: 130px 540px 240px;
grid-template-rows: 40px 110px;
grid-template-areas: 'links links QrCode'
'logo copyright QrCode';
}
/*页尾版权 头部链接*/
.public-footer>.footer-container>.footer-links{
grid-area: links;
width: 630px;
height: 40px;
display: flex;
flex-flow: row nowrap;
justify-content: space-around;
justify-items: center;
align-items: center;
}
.public-footer>.footer-container>.footer-links>a{
width: 80px;
height: 40px;
line-height: 40px;
text-align: center;
color: #959ba2;
}
.public-footer>.footer-container>.footer-links>a:hover{
cursor: pointer;
color: #178cee;
font-weight: bold;
}
/*左侧logo*/
.public-footer>.footer-container>.footer-logo{
grid-area: logo;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", Tahoma, Arial, sans-serif;
font-size: 30px;
place-self: center;
}
/*页尾版权内容*/
.public-footer>.footer-container>.footer-copyright{
grid-area: copyright;
display: flex;
flex-flow: column nowrap;
justify-content: space-around;
}
.public-footer>.footer-container>.footer-copyright>span{
width: 100%;
height: 30px;
line-height: 30px;
text-align: left;
}
/*页尾二维码*/
.public-footer>.footer-container>.footer-QrCode{
grid-area: QrCode;
width: 240px;
height: 200px;
/*设置黑色边框线*/
border-left: 1px solid black;
}
.public-footer>.footer-container>.footer-QrCode>.footer-QrCode-content{
width: 110px;
margin-left: 30px;
display: flex;
flex-flow: column nowrap;
}
.public-footer>.footer-container>.footer-QrCode>.footer-QrCode-content>span{
width: 110px;
height: 40px;
line-height: 40px;
text-align: center;
}
.public-footer>.footer-container>.footer-QrCode>.footer-QrCode-content>img{
width: 110px;
height: 110px;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>购物车头部标题</title>
<link rel="stylesheet" href="shop_cart_headline.css">
</head>
<body>
<div class="shop-cart-headline-back">
<div class="shop-cart-headline">
<a href="">
<img src="../../images/logo.png" alt="">
<span>购物车</span>
</a>
<div class="cart-search">
<input type="search" id="search" name="search">
<label for="search">搜索</label>
</div>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "../public/css/public_reset.css";
/*单页参考线*/
/* *:not(body){ outline: 1px dashed red; }*/
/*背景色DIV 样式*/
.shop-cart-headline-back{
width: 100%;
height: 100px;
background-color: white;
}
/*最外层 flex弹性盒子设置*/
.shop-cart-headline-back>.cart-headline{
width: 1200px;
height: 100px;
margin: 0 auto;
/*转换为flex 弹性盒子*/
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
}
/*左侧logo*/
.shop-cart-headline-back>.cart-headline>a{
width: 240px;
height: 76px;
display: flex;
flex-flow: row nowrap;
justify-content: center;
}
.shop-cart-headline-back>.cart-headline>a>span{
width: 76px;
height: 36px;
font-size: 20px;
color: #888888;
line-height: 36px;
font-style: italic;
font-weight: bold;
margin-bottom: 10px;
align-self: end;
}
.shop-cart-headline-back>.cart-headline>a:hover{
cursor: pointer;
}
/*右侧搜索框*/
.shop-cart-headline-back>.cart-headline>.cart-search{
width: 280px;
height: 30px;
border: 2px solid #178cee;
display: flex;
/*转换 flex弹性盒子*/
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
}
.shop-cart-headline-back>.cart-headline>.cart-search:hover{
box-shadow: 0 0 5px #888888;
}
.shop-cart-headline-back>.cart-headline>.cart-search>input{
width: 220px;
height: 30px;
/*去掉原始边框样式*/
border: none;
}
.shop-cart-headline-back>.cart-headline>.cart-search>label{
width: 60px;
height: 30px;
line-height: 30px;
text-align: center;
background-color: #178cee;
color: #ffffff;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付结算信息组件</title>
<link rel="stylesheet" href="shop_payinfo.css">
<style>
</style>
</head>
<body>
<!--支付结算信息组件-->
<div class="shop-pay">
<!--支付结算信息-->
<div class="pay-info">
<!--邮寄地址信息-->
<div class="address">
<div class="address-header">
<span>邮寄信息</span>
<button>更多地址</button>
<button>新增地址</button>
</div>
<div class="address-check">
<span>张小帅</span>
<span>北京市朝阳区广渠东路18号,狗肉馆前台</span>
<span>17****36859</span>
<span>默认地址</span>
</div>
</div>
<!--支付方式-->
<div class="pay-mode">
<span>支付方式</span>
<span>在线支付</span>
<span>货到付款</span>
<span><a href="">更多>></a></span>
</div>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "../public/css/public_reset.css";
/*单页参考线*/
/**:not(body){ outline: 1px dashed;}*/
/*购物车结算信息组件*/
.shop-pay{
width: 100%;
margin: 0 auto;
}
.shop-pay>.pay-info{
width: 1200px;
background-color: white;
display: flex;
margin: 20px auto;
flex-flow: column nowrap;
}
/*邮寄信息*/
.shop-pay>.pay-info>.address{
height: 100px;
border: 1px solid #f1f1f1;
margin-bottom: 15px;
display: flex;
flex-flow: column nowrap;
justify-content: space-around;
}
.shop-pay>.pay-info>.address>.address-header{
height: 40px;
line-height: 40px;
text-align: left;
}
.shop-pay>.pay-info>.address>.address-header>span{
font-size: 16px;
color: #333333;
font-weight: bolder;
margin-left: 20px;
}
.shop-pay>.pay-info>.address>.address-header>button{
width: 80px;
height: 28px;
color: white;
border-radius: 5px;
background-color: #178cee;
border: none;
}
.shop-pay>.pay-info>.address>.address-header>button:first-of-type{
margin-left: 200px;
}
.shop-pay>.pay-info>.address>.address-header>button:first-of-type:hover{
font-weight: bolder;
background-color: #f64c59;
cursor: pointer;
}
.shop-pay>.pay-info>.address>.address-header>button:last-of-type{
margin-left: 50px;
}
.shop-pay>.pay-info>.address>.address-header>button:last-of-type:hover{
cursor: pointer;
font-weight: bolder;
background-color: #f64c59;
box-shadow: 0 0 5px #888888;
}
/*显示地址信息*/
.shop-pay>.pay-info>.address>.address-check{
height: 30px;
line-height: 30px;
display: flex;
flex-flow: row nowrap;
}
.shop-pay>.pay-info>.address>.address-check>span{
margin-left: 20px;
}
.shop-pay>.pay-info>.address>.address-check>span:first-of-type{
font-weight: bolder;
margin-left: 60px;
}
.shop-pay>.pay-info>.address>.address-check>span:last-of-type{
width: 80px;
height: 30px;
text-align: center;
color: white;
background-color: #aaaaaa;
}
/*支付方式*/
.shop-pay>.pay-info>.pay-mode{
width: 100px;
padding-bottom: 15px;
display: grid;
grid-template-columns: repeat(3,160px) ;
grid-template-rows: repeat(2,40px);
}
.shop-pay>.pay-info>.pay-mode>span:first-of-type{
grid-column: 1/4;
grid-row: 1/2;
font-size: 16px;
color: #333333;
font-weight: bolder;
margin-left: 20px;
}
.shop-pay>.pay-info>.pay-mode>span:nth-child(2){
grid-column: 1/2;
grid-row: 2/3;
width: 80px;
height: 30px;
line-height: 30px;
text-align: center;
border: 2px solid #f64c59;
margin-left: 60px;
}
.shop-pay>.pay-info>.pay-mode>span:nth-child(3){
grid-column: 2/3;
grid-row: 2/3;
width: 80px;
height: 30px;
line-height: 30px;
text-align: center;
border: 2px solid #aaaaaa;
}
.shop-pay>.pay-info>.pay-mode>span:nth-child(4){
grid-column: 3/4;
grid-row: 2/3;
align-self: center;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>购物车商品列表组件</title>
<link rel="stylesheet" href="shop_cart_list.css">
</head>
<body>
<!--购物车商品列表组件-->
<div class="shop-cart-list">
<!--商品列表-->
<div class="list-container">
<span>全部商品</span>
<!--标题栏-->
<div class="list-title">
<span class="checkbox-all">
<input type="checkbox" id="checkbox-all" name="checkbox-all">
<label for="checkbox-all">全选</label>
</span>
<span>商品</span>
<span>单价</span>
<span>数量</span>
<span>小计</span>
<span>操作</span>
</div>
<!--供应商-自营-->
<div class="supplier">
<div class="supplier-checkbox">
<input type="checkbox" id="supplier-checkbox" name="supplier-checkbox">
<label for="supplier-checkbox">商城自营</label>
</div>
<!--单件商品描述-->
<div class="goods">
<!--商品勾选-->
<div class="goods-checkbox">
<input type="checkbox" id="goods-checkbox-1" name="goods-checkbox-1">
<label for="goods-checkbox-1"></label>
</div>
<!--商品图片-->
<a href=""><img src="../../images/shop/Mate30.jpg" alt=""></a>
<!--商品描述-->
<div class="goods-describe">
<a href=""><span>华为 HUAWEI Mate30 Pro 5G 麒麟990 OLED环屏幕双4000万徕卡四摄</span></a>
<div>
<p>丹霞橙</p>
<p>8GB+256GB</p>
</div>
</div>
<!--商品单价-->
<span class="goods-price">¥6899.00</span>
<!--商品数量-->
<div class="goods-number">
<input type="number" id="goods-number-1" name="goods-number-1" value="1">
<label for="goods-number-1"></label>
</div>
<!--商品小计-->
<span class="goods-total">¥6899.00</span>
<!--删除商品-->
<div class="goods-handle">
<a href="">删除</a>
<a href="">到货通知</a>
</div>
</div>
<div class="goods">
<!--商品勾选-->
<div class="goods-checkbox">
<input type="checkbox" id="goods-checkbox-2" name="goods-checkbox">
<label for="goods-checkbox-2"></label>
</div>
<!--商品图片-->
<a href=""><img src="../../images/shop/Mate30.jpg" alt=""></a>
<!--商品描述-->
<div class="goods-describe">
<a href=""><span>华为 HUAWEI Mate30 Pro 5G 麒麟990 OLED环屏幕双4000万徕卡四摄</span></a>
<div>
<p>丹霞橙</p>
<p>8GB+256GB</p>
</div>
</div>
<!--商品单价-->
<span class="goods-price">¥6899.00</span>
<!--商品数量-->
<div class="goods-number">
<input type="number" id="goods-number-2" name="goods-number-2" value="1">
<label for="goods-number-2"></label>
</div>
<!--商品小计-->
<span class="goods-total">¥6899.00</span>
<!--删除商品-->
<div class="goods-handle">
<a href="">删除</a>
<a href="">到货通知</a>
</div>
</div>
</div>
<!--供应商-电脑专卖店-->
<div class="supplier">
<div class="supplier-checkbox">
<input type="checkbox" id="supplier-checkbox-1" name="supplier-checkbox-1">
<label for="supplier-checkbox-1">电子产品专卖店</label>
</div>
<!--单件商品描述-->
<div class="goods">
<!--商品勾选-->
<div class="goods-checkbox">
<input type="checkbox" id="goods-checkbox-z1" name="goods-checkbox-z1">
<label for="goods-checkbox-z1"></label>
</div>
<!--商品图片-->
<a href=""><img src="../../images/shop/Mate30.jpg" alt=""></a>
<!--商品描述-->
<div class="goods-describe">
<a href=""><span>华为 HUAWEI Mate30 Pro 5G 麒麟990 OLED环屏幕双4000万徕卡四摄</span></a>
<div>
<p>丹霞橙</p>
<p>8GB+256GB</p>
</div>
</div>
<!--商品单价-->
<span class="goods-price">¥6899.00</span>
<!--商品数量-->
<div class="goods-number">
<input type="number" id="goods-number-z1" name="goods-number-z1" value="1">
<label for="goods-number-z1"></label>
</div>
<!--商品小计-->
<span class="goods-total">¥6899.00</span>
<!--删除商品-->
<div class="goods-handle">
<a href="">删除</a>
<a href="">到货通知</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "../public/css/public_reset.css";
/*单页参考线*/
/**:not(body){ outline: 1px dashed;}*/
/*组件页--最外层DIV*/
.shop-cart-list{
width: 100%;
margin: 20px 0;
}
.shop-cart-list>.list-container{
width: 1200px;
background-color: white;
color: #666666;
border: 1px solid #cccccc;
margin: 0 auto;
display: flex;
flex-flow: column nowrap;
justify-content: space-around;
}
/*列表标题 -全部商品*/
.shop-cart-list>.list-container>span:first-of-type{
width: 80px;
height: 40px;
line-height: 40px;
font-size: 16px;
font-weight: bold;
color: #f64c59;
text-align: center;
border-bottom: 1px solid #f64c59;
}
/*商品列表标题栏*/
.shop-cart-list>.list-container>.list-title{
width: 1200px;
height: 32px;
background-color: #f3f3f3;
line-height: 32px;
text-align: center;
/*转网格*/
display: grid;
grid-template-rows: 32px;
grid-template-columns: 80px 600px 120px 150px 100px 150px;
}
.shop-cart-list>.list-container>.list-title>.checkbox-all{
justify-self: start;
margin-left: 10px;
}
.shop-cart-list>.list-container>.list-title>span:nth-child(2){
margin-left: 20px;
text-align: left;
}
/*店铺商品列表*/
.shop-cart-list>.list-container>.supplier{
width: 100%;
height: auto;
margin-bottom: 26px;
display: flex;
flex-flow: column nowrap;
}
/*商铺商品-全选*/
.shop-cart-list>.list-container>.supplier>.supplier-checkbox{
width: 98%;
height: 20px;
line-height: 20px;
text-align: left;
margin: 10px 0 0 10px;
border-bottom: 2px solid #aaa;
}
/*商品条目*/
.shop-cart-list>.list-container>.supplier>.goods{
width: 100%;
height: 120px;
background-color: #fff4e8;
border-bottom: 1px solid #cccccc;
color: #333333;
display: flex;
flex-flow: row nowrap;
align-items: start;
}
/*商品勾选框*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-checkbox{
margin: 20px 10px 0 10px;
}
/*商品图片*/
.shop-cart-list>.list-container>.supplier>.goods>a{
margin-top: 20px;
}
/*商品描述*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-describe{
height: 40px;
line-height: 20px;
text-align: left;
font-size: 14px;
margin: 20px 10px 0 10px;
display: flex;
flex-flow: row wrap;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-describe>a{
width: 210px;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-describe>div{
margin-left: 50px;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-describe>div>p {
color: #666666;
}
/*商品单价*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-price{
margin: 20px 0 0 250px ;
font-size: 16px;
font-weight: 200;
color: #333333;
}
/*商品数量*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-number{
width: 56px;
height: 20px;
margin: 20px 0 0 70px;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-number>input{
width: 56px;
height: 20px;
}
/*商品价格小计*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-total{
margin: 20px 0 0 70px ;
font-size: 16px;
font-weight: 300;
color: #333333;
}
/*商品删除操作*/
.shop-cart-list>.list-container>.supplier>.goods>.goods-handle{
width: 60px;
height: 50px;
line-height: 20px;
margin: 20px 0 0 60px;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
justify-items: center;
align-items: start;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-handle>a{
color: #333333;
}
.shop-cart-list>.list-container>.supplier>.goods>.goods-handle>a:hover{
color: #f64c59;
cursor: pointer;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>购物车页面结算组件</title>
<link rel="stylesheet" href="shop_cart_pay.css">
</head>
<body>
<!--购物车页面结算组件-->
<div class="shop-cart-pay">
<div class="total-amount">
<div class="total-left">
<span>
<input type="checkbox" id="total-amount" name="total-amount">
<label for="total-amount">全选</label>
</span>
<a href="">删除选中商品</a>
<a href="">移到关注</a>
<a href="">清理购物车</a>
</div>
<div class="total-right">
<span>已选中 <i>4</i>件商品</span>
<span>总价:<i>¥6899.00</i></span>
<button>去结算</button>
</div>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "../public/css/public_reset.css";
/*单页参考线*/
/**:not(body){ outline: 1px dashed;}*/
/*订单合计*/
.shop-cart-pay>.total-amount{
width: 100%;
height: 40px;
background-color: #e9e9e9;
line-height: 40px;
text-align: center;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
}
/*合计左侧*/
.shop-cart-pay>.total-amount>.total-left{
width: 300px;
margin: 0 10px;
display: flex;
justify-content: space-around;
}
.shop-cart-pay>.total-amount>.total-left>a:last-of-type{
font-weight: bold;
}
.shop-cart-pay>.total-amount>.total-left>a:hover{
cursor: pointer;
color: #f64c59;
}
/*合计右侧*/
.shop-cart-pay>.total-amount>.total-right{
width: 400px;
margin-right: 20px;
display: flex;
justify-content: space-between;
}
.shop-cart-pay>.total-amount>.total-right i{
font-size: 18px;
font-weight: bold;
color: #f64c59;
margin: 0 10px;
}
.shop-cart-pay>.total-amount>.total-right>button{
width: 100px;
height: 40px;
color: white;
font-weight: bold;
background-color: #f64c59;
border: none;
}
.shop-cart-pay>.total-amount>.total-right>button:hover{
cursor: pointer;
background-color: #178cee;
box-shadow: 0 0 5px #888888;
}
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付结算条组件</title>
<link rel="stylesheet" href="shop_pay.css">
<style>
</style>
</head>
<body>
<!--支付结算条组件-->
<div class="shop-pay">
<div class="pay-total">
<span><i>3</i>件商品,总商品金额:</span>
<span>¥30496.00</span>
<span>调货服务费:</span>
<span>¥50.00</span>
<span>运费</span>
<span>¥20.00</span>
<div class="total-row">
<span>应付金额: <i>¥30566.00</i></span>
<div class="adder-info">
<span>邮寄地址:北京市朝阳区广渠东路18号,狗肉馆前台</span>
<span>收货人:张小帅 17****36859</span>
</div>
</div>
<button>提交订单</button>
</div>
</div>
</body>
</html>
css代码
/*引入格式重置样式表*/
@import "../public/css/public_reset.css";
/*单页参考线*/
/**:not(body){ outline: 1px dashed;}*/
/*组件页--最外层DIV*/
.shop-pay{
width: 1200px;
height: auto;
background-color: white;
font-size: 14px;
}
.shop-pay>.pay-total{
width: 100%;
display: grid;
grid-template-columns: 1fr 120px;
grid-template-rows: 36px 36px 36px 80px 80px;
justify-items: end;
}
/*费用统计分项*/
.pay-total>span{
align-self: center;
}
.pay-total>span>i{
font-size: 20px;
font-weight: bolder;
color: #f64c59;
margin-right: 10px;
}
.pay-total>span:nth-child(2){
font-size: 20px;
color: #f64c59;
font-weight: bolder;
margin-right: 20px;
}
.pay-total>span:nth-child(4){
font-size: 18px;
color: darkorange;
margin-right: 20px;
}
.pay-total>span:nth-child(6){
font-size: 16px;
color: #333333;
margin-right: 20px;
}
/*总计金额 所在行*/
.pay-total>.total-row{
grid-row: 4/5;
grid-column: 1/3;
height: 80px;
background-color: #e9e9e9;
line-height: 40px;
text-align: right;
place-self: stretch;
}
.pay-total>.total-row>span>i{
font-size: 24px;
font-weight: bolder;
color: #f64c59;
margin: 0 20px;
}
.pay-total>.total-row>.adder-info>span{
font-weight: bolder;
margin-right: 20px;
}
/*提交订单按钮*/
.pay-total>button{
grid-row: 5/6;
grid-column: 2/3;
align-self: center;
margin-right: 20px;
width: 120px;
height: 40px;
color: white;
font-size: 20px;
font-weight: bolder;
background-color: #f64c59;
border: none;
}
.pay-total>button:hover{
cursor: pointer;
background-color: #178cee;
box-shadow: 0 0 6px #cccccc;
}
因为基于组件进行拼接,所以购物车页面和结算页面的HTML就不罗列了,主要展示引用css样式表部分;
shop_cart.css
/*引入格式重置样式表*/
@import "../components/public/css/public_reset.css";
/*引入公共头部样式表*/
@import "../components/public/css/public_header.css";
/*引入购物车 头部样式表*/
@import "../components/shop/shop_cart_headline.css";
/*引入购物车 商品列表样式表*/
@import "../components/shop/shop_cart_list.css";
/*引入购物车 购物车页面结算组件*/
@import "../components/shop/shop_cart_pay.css";
/*引入公共底部样式表*/
@import "../components/public/css/public_footer.css";
shop_pays.css
/*引入格式重置样式表*/
@import "../components/public/css/public_reset.css";
/*引入公共头部样式表*/
@import "../components/public/css/public_header.css";
/*引入结算页 头部样式表*/
@import "../components/shop/shop_cart_headline.css";
/*引入 支付结算信息组件*/
@import "../components/shop/shop_payinfo.css";
/*引入购物车列表组件*/
@import "../components/shop/shop_cart_list.css";
/*引入结算页组件*/
@import "../components/shop/shop_pay.css";
/*引入公共底部样式表*/
@import "../components/public/css/public_footer.css";