Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:完成的很好
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="shop_shopping_cart.css">
<title>商城系统的购物车</title>
</head>
<body>
<!--商城购物车-->
<div class="shop-shopping-cart">
<h3>我的购物车</h3>
<!--购物车头部-->
<header>
<!--flex-->
<span>
<input type="checkbox" id="all-selected" checked>
<label for="all-selected">全选</label>
</span>
<span>商品</span>
<span>单价</span>
<span>数量</span>
<span>小计</span>
<span>操作</span>
</header>
<!--购物车主体-->
<main>
<div>
<span>
<label><input type="checkbox" name="choose" checked></label>
</span>
<!--图文介绍-->
<span class="pic-intro">
<a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
<a href="">商品简介...</a>
</span>
<span>500.00</span>
<span>
<label><input type="number" name="count" value="1" min="1"></label>
</span>
<span><i>¥</i>500.00</span>
<span><a href="">删除</a></span>
</div>
<div>
<span>
<label><input type="checkbox" name="choose" checked></label>
</span>
<!--图文介绍-->
<span class="pic-intro">
<a href=""><img src="../../../static/images/shop/shop2.jpg" alt=""></a>
<a href="">商品简介...</a>
</span>
<span>500.00</span>
<span>
<label><input type="number" name="count" value="1" min="1"></label>
</span>
<span><i>¥</i>500.00</span>
<span><a href="">删除</a></span>
</div>
<div>
<span>
<label><input type="checkbox" name="choose" checked></label>
</span>
<!--图文介绍-->
<span class="pic-intro">
<a href=""><img src="../../../static/images/shop/shop3.jpg" alt=""></a>
<a href="">商品简介...</a>
</span>
<span>500.00</span>
<span>
<label><input type="number" name="count" value="1" min="1"></label>
</span>
<span><i>¥</i>500.00</span>
<span><a href="">删除</a></span>
</div>
<div>
<span>
<label><input type="checkbox" name="choose" checked></label>
</span>
<!--图文介绍-->
<span class="pic-intro">
<a href=""><img src="../../../static/images/shop/shop4.jpg" alt=""></a>
<a href="">商品简介...</a>
</span>
<span>500.00</span>
<span>
<label><input type="number" name="count" value="1" min="1"></label>
</span>
<span><i>¥</i>500.00</span>
<span><a href="">删除</a></span>
</div>
</main>
<!--购物车底部-->
<footer>
<span>数量: <i>4</i></span>
<span>金额: <i>2000</i></span>
<button>去结算</button>
</footer>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
/*参考线 */
/* outline: 1px dashed red;*/
}
body {
font-size: 13px;
color: #555555;
background-color: #efefef;
}
a {
color: #404040;
text-decoration: none;
font-size: 13px;
}
li {
list-style: none;
}
@import url(../../public_reset.css);
.shop-shopping-cart {
width: 1200px;
background-color: #fff;
margin: 30px auto;
padding: 15px 0;
`border-radius`: 8px;
`box-sizing`: border-box;
}
.shop-shopping-cart:hover {
`box-shadow`: 0 0 8px #888888;
}
/*标题*/
.shop-shopping-cart > h3 {
font-size: 20px;
text-align: center;
font-weight: normal;
margin-bottom: 20px;
}
/*购物车头部*/
.shop-shopping-cart > header {
height: 40px;
border-bottom: 1px solid #cccccc;
/*flex*/
`display`: flex;
`justify-content`: space-around;
`align-items`: center;
}
/*购物车主体*/
.shop-shopping-cart > main {
margin: 20px 0;
}
/*购物车中的每一条记录, 每一个商品*/
.shop-shopping-cart > main > div {
height: 80px;
/*flex*/
display: flex;
`justify-content`: space-around;
`align-items`: center;
}
.shop-shopping-cart > main > div:hover {
background-color: lightcyan;
}
.shop-shopping-cart > main > div .pic-intro {
width: 250px;
`display`: flex;
`align-items`: center;
}
.shop-shopping-cart > main > div .pic-intro img {
width: 60px;
height: 45px;
margin-right: 10px;
}
.shop-shopping-cart > main > div a:hover {
color: lightcoral;
}
/*微调第一个复选框*/
.shop-shopping-cart > main > div > span:first-of-type {
position: relative;
left: 25px;
}
.shop-shopping-cart > main > div > span.pic-intro {
position: relative;
left: -40px;
}
.shop-shopping-cart > main > div > span:nth-of-type(3) {
position: relative;
left: -80px;
}
.shop-shopping-cart > main > div > span:nth-of-type(4) {
position: relative;
left: -60px;
}
.shop-shopping-cart > main > div > span:nth-of-type(4) input {
width: 60px;
}
.shop-shopping-cart > main > div > span:nth-last-of-type(2) {
position: relative;
left: -50px;
}
.shop-shopping-cart > main > div > span:last-of-type {
position: relative;
left: -50px;
}
.shop-shopping-cart > main > div > span:nth-last-of-type(2) i {
color: green;
font-size: 1.01rem;
margin-right: 3px;
}
/*购物车底部*/
.shop-shopping-cart > footer {
height: 70px;
padding: 20px;
border-top: 1px solid #cccccc;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
align-items: center;
}
.shop-shopping-cart > footer > *:not(:last-child) {
width: 180px;
}
.shop-shopping-cart > footer > button {
height: 40px;
width: 120px;
background-color: lightcoral;
border: none;
color: white;
font-size: 1.1rem;
}
.shop-shopping-cart > footer > button:hover {
background-color: seagreen;
cursor: pointer;
}
购物车商品在页面上单行多列显示,适合flex的默认排列布局,由于商品的属性比较多,css细节控制需要耐心去微调,才能达到很好的显示效果。