商品列表展示
html代码展示
<!--
* @Descripttion:
* @version:
* @Author: pengpeng
* @Date: 2019-12-27 13:31:35
* @LastEditors : pengpeng
* @LastEditTime : 2019-12-27 17:59:29
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./demo.css">
<title>二手交易</title>
</head>
<body>
<div class="public-shop">
<div class="public-shop-title1">
<a href="javascript:;">抢好货</a>
<span>0低价、便捷安全、快速</span>
</div>
<div class="public-shop-title2">
<span>热门分类</span>
<a href="javascript:;">美女写真</a>
<a href="javascript:;">美女写真</a>
<a href="javascript:;">美女写真</a>
<a href="javascript:;">美女写真</a>
<a href="javascript:;">美女写真</a>
</div>
<div class="public-shop-list">
<div class="public-shop-list-show">
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
<div class="shop-img">
<a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
<a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
<div>
<span>¥</span>
<span>美女</span>
</div>
</div>
</div>
<div class="shop-list-money">
<div>
<a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
<a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
<a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
<a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
</div>
<a href=""><img src="/public/static/images/ad/image.png" alt=""></a>
<a href=""><img src="/public/static/images/ad/ad2.jpg" alt=""></a>
</div>
</div>
</div>
</body>
</html>
css代码展示
/* 初始化 */
@import url(../public/_public.css);
.public-shop{
width: 1200px;
border: 1px solid #978b8b;
box-sizing: border-box;
border-radius: 5px;
margin: auto;
background-color: #fff;
padding: 10px;
}
.public-shop:hover{
box-shadow: 0 0 8px #888;
}
.public-shop > .public-shop-title1{
height: 50px;
border-bottom: 1px solid #cccccc;
}
.public-shop > .public-shop-title1 > a{
font-size: 23px;
font-weight: bolder;
margin-right: 20px;
}
.public-shop > .public-shop-title1 > span{
color: red;
}
.public-shop > .public-shop-title2{
height: 55px;
}
.public-shop > .public-shop-title2 > span{
color: red;
font-size: 25px;
}
.public-shop > .public-shop-title2 > span ~ a{
padding-left: 10px;
}
.public-shop > .public-shop-title2 > span ~ a:hover{
color: chocolate;
}
.public-shop > .public-shop-list{
height: 440px;
display: flex;
flex-flow: row nowrap;
}
.public-shop > .public-shop-list > .public-shop-list-show{
flex-basis: 800px;
padding: 10px;
flex-flow: row wrap;
display: flex;
justify-content: space-between;
}
.public-shop > .public-shop-list > .public-shop-list-show > .shop-img{
width: 178px;
height: 200px;
flex-flow: column nowrap;
display: flex;
justify-content: space-between;
}
.public-shop > .public-shop-list > .public-shop-list-show > .shop-img img{
width: 176px;
height: 120px;
border-radius: 5px;
}
.public-shop > .public-shop-list > .public-shop-list-show > .shop-img div{
display:flex;
}
.public-shop > .public-shop-list > .public-shop-list-show > .shop-img div > span:first-of-type{
color:red;
}
.public-shop > .public-shop-list > .public-shop-list-show > .shop-img div > span:last-of-type{
background-color: cyan;
color: white;
margin-left: auto;
padding: 0 5px;
}
.public-shop > .public-shop-list > .shop-list-money{
flex-basis: 400px;
padding: 10px ;
/* box-sizing: border-box; */
display: flex;
flex-flow: row wrap;
justify-content: space-between;
}
.public-shop > .public-shop-list > .shop-list-money > div img{
width: 190px;
height: 130px;
}
.public-shop > .public-shop-list > .shop-list-money > div{
display:flex;
flex-flow: row wrap;
justify-content: space-around;
}
.public-shop > .public-shop-list > .shop-list-money > a > img{
width: 393px;
height: 60px;
}
评论与回复
html代码展示
<!--
* @Descripttion:
* @version:
* @Author: pengpeng
* @Date: 2019-12-27 23:59:20
* @LastEditors : pengpeng
* @LastEditTime : 2019-12-28 00:58:09
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./demo1.css">
<link rel="stylesheet" href="/public/static/font/iconfont.css">
<title>Document</title>
</head>
<body>
<div class="public-comment">
<div class="public-comment-write">
<span>我要评论</span>
<div>
<label for="write"><img src="/public/static/images/user.png" alt=""></label>
<textarea name="" id="write" cols="30" rows="10"></textarea>
</div>
<button>发表评论</button>
</div>
<div class="public-comment-read">
<span>最新回复</span>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
<div>
<img src="/public/static/images/user.png" alt="">
<div class="read-comment">
<span>用户昵称</span>
<span>好多酱油好多好多酱油好多酱油</span>
<div>
<span>xxxx-xx-xx xx:xx:xx发表</span>
<span><em class="iconfont icon-dianzan"></em>回复</span>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
css代码展示
/* 初始化 */
@import url(../public/_public.css);
.public-comment{
margin: 20px;
border-top: 1px solid #cccccc;
}
.public-comment > .public-comment-write{
padding: 10px;
box-sizing: border-box;
display:flex;
flex-flow: column nowrap;
}
.public-comment > .public-comment-write > span{
font-size: 20px;
font-weight: bolder;
padding: 5px 0;
}
.public-comment > .public-comment-write > div{
margin-top: 20px;
display: flex;
}
.public-comment > .public-comment-write > div > label{
padding-left: 20px;
}
.public-comment > .public-comment-write > div img{
width: 70px;
}
.public-comment > .public-comment-write > div textarea{
height: 200px;
padding: 10px;
box-sizing: border-box;
font-size: 20px;
color: saddlebrown;
margin-left: 20px;
border: none;
border-radius: 10px;
resize: none;
flex: 1;
}
.public-comment > .public-comment-write > div textarea:hover{
box-shadow: 0 0 8px lightpink;
}
.public-comment > .public-comment-write > button{
border: none;
width: 100px;
height: 50px;
font-size: 17px;
border-radius: 10px;
align-self: flex-end;
background-color: yellow;
margin-top: 10px;
}
.public-comment > .public-comment-write > button:hover{
background-color: red;
}
.public-comment > .public-comment-read{
margin-top: 20px;
display: flex;
flex-flow: column;
}
.public-comment > .public-comment-read > span{
font-size: 20px;
font-weight: bolder;
padding: 10px;
}
.public-comment > .public-comment-read > div{
display: flex;
margin: 10px 0;
}
.public-comment > .public-comment-read > div > img{
width: 60px;
padding: 20px 10px;
}
.public-comment > .public-comment-read > div > div{
flex: 1;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
padding: 5px;
}
.public-comment > .public-comment-read > div > div > div{
display: flex;
justify-content: space-between;
}
.public-comment > .public-comment-read > div > div > div:last-of-type em{
color: red;
margin-right: 5px;
}
思路总结
首先先看一遍视频,知道页面的大致逻辑
把整个页面划分成小块,规划哪些地方能用到flex
将小块结合成大块,就形成页面
布局中遇到的问题
不知道页面元素的大小,每次都要翻视频去看
虽然页面看上去是差不多了,但是相比对与老师的代码,有些地方就是不同,反正就是看上去怪怪的。
没有写注释,请老师指点一下。