Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:学到了思维方式, 这才是最大的收获
这个页面分为上下两部分,上面是页面标题,已在2019.12.25课堂上完成,现将在下面商品展示部分完成。
商品展示分为上面的广告标题,中间的分类依据下面的图片展示,其中图片展示又分为左右两个部分。
这里面需要运用到flex容器中再添加flex容器完成下面图片部分的布局。
代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="public_second_hand.css">
<!-- <link rel="stylesheet" href="../public_headline/public_headline.css">-->
<title>public_second_hand</title>
</head>
<body>
<!-- 大标题-->
<div class="public_headline">
<span>二手交易</span>
</div>
<!--二手交易区-->
<div class="public_second_hand">
<!-- 标题1-->
<div class="title1">
<a href="">抢好货</a>
<span>0低价,便捷,安全,快速</span>
</div>
<!-- 标题2-->
<div class="title2">
<span>热门分类</span>
<a href="">写真</a>
<a href="">America</a>
<a href="">Japan</a>
<a href="">China</a>
<a href="">Video</a>
</div>
<!-- 商品展示区-->
<div class="goods">
<!-- 1.左侧商品列表-->
<div class="goods_list">
<!-- 商品简介-->
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop1.jpg" alt="" width="176" height="120"></a>
<a href="">写真</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop2.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop3.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop4.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop5.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop6.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop7.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
<div class="intro">
<a href=""><img src="../../../../static/images/shop/shop8.jpg" alt="" width="176" height="120"></a>
<a href="">写真1</a>
<div class="price">
<span>¥ 333</span>
<span>beauty</span>
</div>
</div>
</div>
<!-- 2.右侧功能快速入口-->
<div class="quick_entry">
<a href=""><img src="../../../../static/images/ad/1.png" alt=""></a>
<a href=""><img src="../../../../static/images/ad/2.png" alt=""></a>
<a href=""><img src="../../../../static/images/ad/3.png" alt=""></a>
<a href=""><img src="../../../../static/images/ad/4.png" alt=""></a>
<div>
<a href=""><img src="../../../../static/images/ad/image.png" alt=""></a>
<a href=""><img src="../../../../static/images/ad/ad2.jpg" alt=""></a>
</div>
</div>
</div>
</div>
</body>
</html>
@import "../pubilc_reset.css";
@import "../public_headline/public_headline.css";
.public_second_hand{
width: 1200px;
padding: 10px;
box-sizing: border-box;
margin: auto;
border-radius: 5px;
background-color: #fff;
}
.public_second_hand:hover{
box-shadow: 0 0 8px #888;
}
/*标题1*/
.public_second_hand > .title1{
height: 40px;
border-bottom: 1px solid #cccccc;
box-sizing: border-box;
}
.public_second_hand > .title1 >a{
font-size: 25px;
margin-right: 20px;
}
.public_second_hand > .title1 >span{
color: red;
}
/*标题2*/
.public_second_hand > .title2 {
margin-top: 20px;
height: 30px;
}
.public_second_hand >.title2 >span{
color: red;
font-size: 23px;
}
.public_second_hand >.title2 >span ~ a{
padding-left: 20px;
font-size: 15px;
}
.public_second_hand >.title2 >span~a:hover{
color: lightcoral;
}
/*商品展示区*/
.public_second_hand >.goods{
display: flex;
height: 440px;
/*flex-flow: row nowrap;*/
}
.public_second_hand >.goods>.goods_list{
padding: 10px;
flex-basis: 800px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
.public_second_hand >.goods>.goods_list>.intro{
width: 178px;
height: 200px;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
}
.public_second_hand >.goods>.goods_list>.intro img{
border-bottom: 1px solid #cccccc;
padding-top: 10px;
border-radius:5px
}
.public_second_hand >.goods>.goods_list>.intro>a{
font-size: 15px;
font-family: "Microsoft YaHei UI";
}
.public_second_hand >.goods>.goods_list>.intro span:first-of-type{
color: red;
}
.public_second_hand >.goods>.goods_list>.intro >div{
display: flex;
padding-top: 10px;
}
.public_second_hand >.goods>.goods_list>.intro span:last-of-type{
color: red;
background-color: #55ce9f;
padding: 0 2px;
margin-left: auto;
}
/* 功能快速入口区*/
.public_second_hand >.goods>.quick_entry{
flex-basis: 400px;
padding: 10px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
.public_second_hand >.goods>.quick_entry >a img{
width: 190px;
height: 130px;
}
.public_second_hand >.goods>.quick_entry>div{
width: 400px;
display: flex;
flex-direction: column;
}
.public_second_hand >.goods>.quick_entry>div img{
width: 393px;
height: 60px;
}
二手交易页面主要分为上面的评论输入区域和下面的已评论区域两部分,大致需要运用到的技术和二手商品页面差不多,首先先写好dom结构,再写css样式文档
代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="public_comment_reply.css">
<link rel="stylesheet" href="../../../../static/font/iconfont.css">
<title>public_comment_reply</title>
</head>
<body>
<div class="public_comment_reply">
<!-- 评论-->
<div class="comment">
<h3>我要评论</h3>
<div>
<label for="comment">
<img src="../../../../static/images/user.png" alt="">
</label>
<textarea name="" id="comment"></textarea>
</div>
<button>发表评论</button>
</div>
<!-- 回复-->
<div class="reply">
<h3>最新回复</h3>
<div>
<img src="../../../../static/images/user.png" width="60" alt="">
<div class="detail">
<span>用户昵称</span>
<span>留言内容:Php.cn</span>
<div>
<span>2019-12-12 15:53:45发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
<div>
<img src="../../../../static/images/user.png" width="60" alt="">
<div class="detail">
<span>用户昵称</span>
<span>留言内容:Php.cn</span>
<div>
<span>2019-12-12 15:53:45发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
<div>
<img src="../../../../static/images/user.png" width="60" alt="">
<div class="detail">
<span>用户昵称</span>
<span>留言内容:Php.cn</span>
<div>
<span>2019-12-12 15:53:45发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
<div>
<img src="../../../../static/images/user.png" width="60" alt="">
<div class="detail">
<span>用户昵称</span>
<span>留言内容:Php.cn</span>
<div>
<span>2019-12-12 15:53:45发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
@import "../pubilc_reset.css";
*{
/*outline: 1px dashed red;*/
}
.public_comment_reply{
padding: 20px;
box-sizing: border-box;
background-color: #fff;
display: flex;
flex-direction: column;
}
.public_comment_reply>.comment img{
width: 60px;
height: 60px;
border-radius: 5px;
box-shadow: 1px 1px 3px #cccccc;
}
.public_comment_reply>.comment{
display: flex;
flex-direction: column;
}
.public_comment_reply>.comment>h3{
padding: 20px 0;
border-top: 1px solid #cccccc;
}
.public_comment_reply>.comment >div{
padding: 15px;
height: 200px;
display: flex;
flex-flow: row nowrap;
}
.public_comment_reply>.comment >div img{
align-self: center;
}
.public_comment_reply>.comment>div textarea{
height: 200px;
margin-left: 30px;
flex: 1;
resize: none;
}
.public_comment_reply>.comment>div textarea:hover{
box-shadow: 0 0 8px #888888;
}
.public_comment_reply>.comment>button{
width: 150px;
height: 40px;
font-size: 14px;
background-color: #f64c59;
border: none;
color: white;
align-self: end;
}
.public_comment_reply>.comment>button:hover{
background-color: #178cee;
box-shadow: 0 0 8px #888888;
cursor: pointer;
}
.public_comment_reply>.reply{
display: flex;
flex-direction: column;
padding: 15px;
}
.public_comment_reply>.reply>h3 {
padding: 20px 0;
}
.public_comment_reply>.reply > div{
display: flex;
margin-top: 30px;
}
.public_comment_reply>.reply > div >img{
align-self: center;
}
.public_comment_reply>.reply > div >.detail{
flex: auto;
display: flex;
flex-direction: column;
margin-left: 20px;
height: 90px;
justify-content: space-between;
}
.public_comment_reply>.reply > div >.detail > div{
display: flex;
justify-content: space-between;
}
.public_comment_reply>.reply > div >.detail > div i{
color: red;
font-size: 1.2rem;
margin-right: 5px;
}
小结:网页的设计要首先确定页面的结构,再确定结构中的元素,最后确定元素的样式,编写组件的时候要首先写出html的dom结构,再写出样式结构,页面元素的大小修改是最麻烦的一道程序,需要耐心调整。这节课学到了网页编写的思想,对接下来的编写有了一个明确的思路和一个方法步骤。