HTML
<div id="gallery">
<a class="thumb-link" href="#img1">
<img src="/assets/images/lightbox/hund1.jpg" class="thumbnail">
</a>
<a class="thumb-link" href="#img2">
<img src="/assets/images/lightbox/hund2.jpg" class="thumbnail">
</a>
<a class="thumb-link" href="#img3">
<img src="/assets/images/lightbox/hund3.jpg" class="thumbnail">
</a>
<a href class="lightbox" id="img1">
<img src="/assets/images/lightbox/hund1.jpg">
</a>
<a href class="lightbox" id="img2">
<img src="/assets/images/lightbox/hund2.jpg">
</a>
<a href class="lightbox" id="img3">
<img src="/assets/images/lightbox/hund3.jpg">
</a>
</div>
CSS
#gallery {
text-align: center;
}
.thumb-link {
display: inline-block;
border: 5px solid #FFF;
}
.thumb-link:hover {
box-shadow: 0px 0px 8px #000;
}
.thumbnail {
width: 80px;
height: auto;
margin: 0;
padding: 0;
display: block;
}
.lightbox {
opacity: 0;
position: fixed;
z-index: -1;
width: 100%;
height: 100%;
text-align: center;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
-webkit-transition: opacity 0.2s ease-out 0s;
transition: opacity 0.2s ease-out 0s;
}
.lightbox img {
max-width: 80%;
max-height: 80%;
}
.lightbox:target {
outline: none;
opacity: 1;
z-index: 999;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}