Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:页面分析是第一步, 写出基本的html dom 结构是第二步, 加上有语义的类名是第三步, 然后再去写css完成页面布局, 想一下, 是不是挺简单的
grid网格容器
,2、将网格容器画为三行两列:grid-template-rows
基于行,进行划分区域,grid-template-columns
基于列,进行区域划分;grid-row/grid-columns
来进行放置,也可以使用命名的方式,grid-area
属性;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="public_second-hand.css">
<title>二手商城-grid布局练习</title>
</head>
<body>
<!--首先进行dom布局-->
<div class="container">
<div class="title1">
<a href="">抢好货</a>
<span>0低价, 便捷,安全,快速</span>
</div>
<div class="title2">
<span>热门分类</span>
<div class="links">
<a href="">美女写真</a>
<a href="">日本美女</a>
<a href="">国内美女</a>
<a href="">美国美女</a>
<a href="">AV美女</a>
</div>
</div>
<div class="goods">
<!--左边,商品详情-->
<div class="left-goods-list">
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
<div class="detail">
<a href=""><img src="static/images/shop/shop1.jpg" alt=""></a>
<a href="">美女性感写真海报墙艺术装饰画帖画图1</a>
<div>
<span>¥333</span>
<span>美女</span>
</div>
</div>
</div>
<div class="right-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/ad2.jpg" alt=""></a>
<a href=""><img src="static/images/ad/image.png" alt=""></a>
</div>
</div>
</div>
</div>
</body>
</html>
*{
margin: 0;
padding: 0;
}
*:not(body){
/*outline: 1px dashed red;*/
}
a{
text-decoration: none;
}
.container{
width: 1200px;
height: 500px;
background-color: #F7F7F7;
border-radius: 4px;
margin:30px auto;
display: grid;
grid-template-columns: 800px 1fr;
grid-template-rows: repeat(2,50px) 1fr;
}
.container:hover{
box-shadow: 0 0 5px #555555;
}
.container>.title1{
grid-row: 1/2;
grid-column: 1/3;
justify-content: center;
align-items: center;
border-bottom: 1px solid #333333;
}
.container>.title1 *{
outline: none;
}
.container>.title1>a{
font-size:32px;
margin:0 5px;
}
.container>.title1>span{
color:red;
}
.container>.title2{
grid-row: 2/3;
grid-column: 1/3;
display: grid;
grid-template-columns: 100px 1fr;
grid-template-rows: auto;
align-items: center;
}
.container>.title2>span{
grid-column: 1/2;
gird-row:1/2;
font-size:23px;
color: red;
}
.container>.title2>links{
grid-column: 2/3;
gird-row:1/2
}
.container>.title2>.links>a{
margin-left:10px;
}
.container>.title2>.links>a:hover{
color: red;
cursor: pointer;
}
.container>.goods{
grid-row: 3/4;
grid-column: 1/3;
display: grid;
grid-template-columns: 800px 1fr;
grid-template-rows: repeat(2 ,1fr);
}
.container>.goods>.left-goods-list{
grid-column: 1/2;
grid-row: 1/2;
display: grid;
grid-template-columns: repeat(4,1fr);
grid-template-rows:200px 200px;
}
.container>.goods>.left-goods-list>.detail{
display: grid;
grid-template-rows: repeat(3,1fr);
grid-template-columns: 1fr;
align-items: start;
justify-items: center;
}
.container>.goods>.left-goods-list>.detail>div{
display: grid;
grid-template-rows: 1fr;
grid-template-columns: repeat(2,1fr);
/*align-items: center;*/
/*justify-content: space-between;*/
/*justify-items: start;*/
}
.container>.goods>.left-goods-list>.detail a{
font-size:13px;
}
.container>.goods>.left-goods-list>.detail>div>span{
/*justify-items: start;*/
}
.container>.goods>.left-goods-list>.detail>div>span:first-of-type{
margin-left:-50px;
color: red;
}
.container>.goods>.left-goods-list>.detail>div>span:last-of-type{
/*justify-self: self-end;*/
color: white;
background-color: #669900;
}
.container>.goods>.left-goods-list>.detail img{
width: 176px;
height: 123px;
}
1、 在进行布局是,画格子和填充都比较容易实现,但是在细节方面完善的时候就总是做得不是很到位,应该是对属性的应用还没有理解透彻,需要再次学习属性的应用范围;
2、 页面的谋划还是要很多练习了进行弥补的,继续加强练习,争取达到课程的要求。