JSFiddle - React, Tailwind, and code Playground
by Ying Chor Ding
HTML
<div class="card">
<input type="checkbox" name="">
<div class="toggle">+</div>
<div class="imgBox">
<img src="http://www.singaporeshipping.com.sg/images/home-bg-1.jpg" alt="" />
</div>
<div class="content">
hello0
</div>
</div>
<div class="card">
<input type="checkbox" name="">
<div class="toggle">+</div>
<div class="imgBox">
<img src="http://www.singaporeshipping.com.sg/images/home-bg-1.jpg" alt="" />
</div>
<div class="content">
hello0
</div>
</div>
CSS
* {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
max-height: 100%;
}
.card {
position: relative;
width: 300px;
height: 400px;
background: #262626;
overflow: hidden;
}
input,
.toggle {
position: absolute;
width:
50px;
height: 50px;
bottom: 20px;
right: 20px;
z-index: 10;
}
input {
opacity: 0;
}
.toggle{
pointer-events: none;
border-radius: 50%;
background: #fff;
transition: 0.5s;
text-align: center;
line-height: 50px;
font-size: 36px;
box-shadow: 0 0 0 0px #9c27b0;
}
input:checked ~ .toggle {
box-shadow: 0 0 0 500px #9c27b0;
transform: rotate(225deg);
}
.imgBox,
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.content {
padding: 20px;
box-sizing: border-box;
z-index: 11;
pointer-events: none;
transition: 0.5s;
opacity: 0;
}
input:checked ~ .content {
opacity: 1;
transition-delay: 0.5s;
}