JSFiddle - React, Tailwind, and code Playground
by Ulrich Bangert
HTML
<figure>
<img src="https://via.placeholder.com/400x300">
<div>
<a href="#" class="left">A</a>
<a href="#" class="right">B</a>
</div>
</figure>
CSS
body {
margin: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
figure {
position: relative;
margin: 0;
padding: 0;
background-color: black;
}
figure div {
position: absolute;
left: 0;
top: 50%;
width: 100%;
transform: translate(0, -50%);
text-align: center;
}
figure div a {
background-color: white;
color: black;
display: inline-block;
font-size: 4em;
text-decoration: none;
opacity: 0;
transition: all cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s;
transform: translateY(-2em);
}
figure img {
vertical-align: top;
transition: 0.5s;
}
figure div a:hover {
color: white;
background-color: black;
}
figure div a:last-child {
transition-delay: 0.1s;
margin-left: 0.5em;
}
figure:hover div a {
opacity: 1;
transform: translateY(0);
}
figure:hover img {
opacity: 0.5;
}