1,效果图
2,html部分
<div class="gallery-section">
<div class="inner-width">
<h1>生活 / 运动</h1>
<div class="border"></div>
<div class="gallery">
<a href="img/200.jpg" class="image">
<img src="img/200.jpg" alt="">
</a>
<a href="img/201.jpg" class="image">
<img src="img/201.jpg" alt="">
</a>
<a href="img/203.jpg" class="image">
<img src="img/203.jpg" alt="">
</a>
<a href="img/204.jpg" class="image">
<img src="img/204.jpg" alt="">
</a>
<a href="img/205.jpg" class="image">
<img src="img/205.jpg" alt="">
</a>
<a href="img/206.jpg" class="image">
<img src="img/206.jpg" alt="">
</a>
<a href="img/207.jpg" class="image">
<img src="img/207.jpg" alt="">
</a>
<a href="img/208.jpg" class="image">
<img src="img/208.jpg" alt="">
</a>
</div>
</div>
</div>
3,css部分
.gallery-section{
width: 100%;
padding: 60px 0;
background: #f1f1f1;
}
.inner-width{
width: 100%;
max-width: 1200px;
margin: auto;
padding: 0 20px;
}
.gallery-section h1{
text-align: center;
text-transform: uppercase;
color: #333;
}
.border{
width: 180px;
height: 4px;
background: #333;
margin: 60px auto;
}
.gallery-section .gallery{
display: flex;
flex-wrap: wrap-reverse;
justify-content: center;
}
.gallery-section .image{
flex: 25%;
overflow: hidden;
cursor: pointer;
}
.gallery-section .image img{
width: 100%;
height: 100%;
transition: 0.4s;
}
.gallery-section .image:hover img{
transform: scale(1.4) rotate(15deg);
}
@media screen and (max-width:960px) {
.gallery-section .image{
flex: 33.33% ;
}
}
@media screen and (max-width:768px) {
.gallery-section .image{
flex: 50% ;
}
}
@media screen and (max-width:480px) {
.gallery-section .image{
flex: 100% ;
}
}
记录每一个前段小案例!!!