麻烦老师检查一下,还有什么地方可以优化呢?
来源:4-11 自由编程
qq_慕侠5425943
2021-03-19 14:22:42
相关代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="自由编程.css">
</head>
<body>
<div class="top">
<h1>GALLERY</h1>
<div class="line"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting<br/>
industry.lorem Ipsum has been the industry's standard dummy<br/>
text ever since the 1500s.
</p>
</div>
<div class="max">
<div class="upper">
<div class="picbox">
<img src="images/03-01.jpg" alt="">
<div class="details"><p>Science Lab</p></div>
</div>
<div class="picbox">
<img src="images/03-02.jpg" alt="">
<div class="details"><p>Indoor Stadium</p></div>
</div>
<div class="picbox">
<img src="images/03-03.jpg" alt="">
<div class="details"><p>Transportion</p></div>
</div>
</div>
<div class="lower">
<div class="picbox">
<img src="images/03-04.jpg" alt="">
<div class="details"><p>Kids Room</p></div>
</div>
<div class="picbox">
<img src="images/03-05.jpg" alt="">
<div class="details"><p>Meditation Classes</p></div>
</div>
<div class="picbox">
<img src="images/03-06.jpg" alt="">
<div class="details"><p>Kids Play Ground</p></div>
</div>
</div>
</div>
</body>
</html
*{
margin: 0;
padding: 0;
}
/* 大盒子 */
.top h1{
text-align: center;
}
.top .line{
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 0 auto;
}
.top p{
text-align: center;
}
.max{
width: 1200px;
height: 653px;
margin: 0 auto;
}
.max .upper{
width: 1200px;
height: 290px;
}
.max .lower{
width: 1200px;
height: 290px;
margin-top: 30px;
}
.max .picbox{
width: 400px;
height: 290px;
float: left;
}
.max .picbox img{
display: block;
width: 360px;
height: 240px;
padding-left: 20px;
}
.max .picbox .details{
background-color: black;
width: 360px;
height: 50px;
margin-left: 20px;
}
.max .picbox .details p{
color: lavender;
padding-top: 10px;
padding-left: 10px;
}
1回答
同学你好,代码布局是可以的,样式上还可以优化:
图片下方的文字没有垂直居中显示,左侧间距也不是20px

垂直居中建议使用行高来实现,参考

祝学习愉快!
相似问题