JSFiddle - React, Tailwind, and code Playground
by aswinkumar863
HTML
<div class="parent">
<div class="child">
</div>
</div>
<div class="parent">
<div class="child">
</div>
</div>
<div class="parent">
<div class="child">
</div>
</div>
CSS
.parent {
position:relative;
width:100px;
height:100px;
background:red;
display:inline-block;
float:left;
margin-right:6px;
}
.child {
width:inherit;
height:30px;
position:absolute;
bottom:0;
background-color:blue;
opacity:0;
transition:0.5s;
}
.child.hover {
opacity:1;
}
JavaScript
jQuery(document).ready(function($) {
$(".parent").hover(
function() {
$(".child", this).addClass("hover");
},
function() {
$(".child", this).removeClass("hover");
}
);
});