Gallery image with click to open.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
*{
margin: 0;
padding: 0;
font-family: "montserrat",sans-serif;
box-sizing: border-box;
}
.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%;
}
}
</style>
</head>
<body>
<div class="gallery-section">
<div class="inner-width">
<h1>Rahul's Gallery</h1>
<div class="border"></div>
<div class="gallery">
<a href="img/1.png" class="image">
<img src="img/1.png" alt="">
</a>
<a href="img/2.png" class="image">
<img src="img/2.png" alt="">
</a>
<a href="img/3.png" class="image">
<img src="img/3.png" alt="">
</a>
<a href="img/4.png" class="image">
<img src="img/4.png" alt="">
</a>
<a href="img/5.png" class="image">
<img src="img/5.png" alt="">
</a>
<a href="img/6.png" class="image">
<img src="img/6.png" alt="">
</a>
<a href="img/7.png" class="image">
<img src="img/7.png" alt="">
</a>
<a href="img/8.png" class="image">
<img src="img/8.png" alt="">
</a>
</div>
</div>
</div>
<script>
$(".gallery").magnificPopup({
delegate: 'a',
type: 'image',
gallery:{
enabled: true
}
});
</script>
</body>
</html>