JSFiddle - React, Tailwind, and code Playground
HTML
<section id="gallery">
<!-- thumbnail image wrapped in a link -->
<section class="item">
<a href="#img1">
<img src="http://oi67.tinypic.com/23lblu8.jpg">
</a>
</section>
</section>
<!-- lightbox container hidden with CSS -->
<div class="lightbox" id="img1">
<div class="box">
<a class="close" href="#">X</a>
<p class="title">Lorem ipsum dolore sit amet</p>
<div class="content">
<img class="imgbox" src="http://oi67.tinypic.com/23lblu8.jpg">
<p class="desc">Lorem ipsum dolore sit amet desc fully</p>
</div>
<div class="clear"></div>
</div>
</div>
CSS
#gallery {
width:600px;
}
#gallery a {
text-decoration:none;
}
#gallery .item {
width: 350px; height: 300px; overflow:hidden;
border: 4px solid #333;
margin: 5px;
margin-right: -20px;
}
#gallery .item a {
overflow: hidden;
}
#gallery .item a img {
height: 100%;
align-self: center;
}
.lightbox {
/** Hide the lightbox */
display: none;
/** Apply basic lightbox styling */
position: fixed;
z-index: 9999;
width: 95%;
height: 75%;
top: 0;
left: 0;
color:#333333;
}
.lightbox:target {
/** Show lightbox when it is target */
display: block;
outline: none;
}
.lightbox .box {
width: -webkit-min-content;
width: -moz-min-content;
width: min-content;
min-width:500px;
margin: 0 auto;
padding:10px 20px 10px 20px;
background-color:#FFF;
box-shadow: 0px 1px 26px -3px #777777;
}
.lightbox .title {
margin:0;
padding:0 0 10px 0px;
border-bottom:1px #ccc solid;
font-size:22px;
}
.lightbox .content {
display:block;
position:relative;
}
.imgbox {max-width: 830px; }
.lightbox .content .desc {
z-index:99;
bottom:0;
position:absolute;
padding:10px;
margin:0 0 4px 0;
background:rgba(0,0,0,0.8);
color:#fff;
font-size:17px;
opacity:0;
transition: opacity ease-in-out 0.5s;
}
.lightbox .content:hover .desc {
opacity:1;
}
.lightbox .next,
.lightbox .prev,
.lightbox .close {
display:block;
text-decoration:none;
font-family:Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:22px;
color:#858585;
}
.prev {
float:left;
}
.next, .close {
float:right;
}
.clear {
display:block;
clear:both;
}