JSFiddle - React, Tailwind, and code Playground
by von
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
html {
scroll-behavior: smooth;
}
main *,
main *::after,
main *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
justify-items: center;
grid-gap: 10px;
}
figure {
width: 100%;
cursor: pointer;
margin: 10px;
box-sizing: border-box;
}
figure .image {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
pointer-events: none;
}
.image-span {
position: relative;
display: block;
pointer-events: none;
}
.image-span::after {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
background-image: url("mag-icon.png");
background-position: 100% 100%;
background-size: 35%;
background-repeat: no-repeat;
pointer-events: none;
}
figure figcaption {
text-align: center;
pointer-events: none;
font-weight: bold;
}
figure p {
text-align: justify;
}
.mid-div {
position: absolute;
top: 50%;
}
.modal {
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.3);
z-index: 1;
}
.modal.hide {
display: none;
}
.modal-box {
max-width: 80%;
max-height: 80%;
background-color: wheat;
position: relative;
}
.modal-image {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
.close {
position: absolute;
top: 5px;
right: 5px;
color: white;
text-shadow: 0 0 0 dimgray;
cursor: pointer;
}
.close:hover {
color: dimgray;
text-shadow: 0 0 0 white;
}
i {
position: absolute;
top: 50%;
transform: translateY(-50%);
padding: 10px;
color: #aaa;
transition: all 300ms;
}
i:hover {
color: #fff;
transform: scale(1);
cursor: pointer;
}
i.fa-arrow-right...