JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Image Swap on Hover with CSS</title>
<style type="text/css">
.card {
width: 130px;
height: 195px;
position: relative;
display: inline-block;
}
.card .img-top {
display: none;
position: absolute;
top: 0;
left: 0;
z-index: 99;
}
.card:hover .img-top {
display: inline;
}
</style>
</head>
<body>
<div class="card">
<img src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/242ce817-97a3-48fe-9acd-b1bf97930b01/09-posterization-opt.jpg" alt="Card Back">
<img...
CSS
.card {
width: 100px;
height: 100px;
/* background: url("images/card-back.jpg") no-repeat; */
display: inline-block;
}
.card:hover {
background: white;
}