Despite my efforts, the image did not change to another one when hovering. Instead, the second image appeared alongside the first one. Here is the code I used, can you please point out what I might have done wrong?
.card {
width: 130px;
height: 195px;
position: relative;
display: inline-block;
margin: 50px;
}
.card .img-top {
display: none;
position: absolute;
top: 0;
left: 0;
z-index: 99;
}
.card:hover .img-top {
display: inline;
}
.card {
width: 130px;
height: 195px;
position: relative;
display: inline-block;
margin: 50px;
}
.card .img-top {
display: none;
position: absolute;
top: 0;
left: 0;
z-index: 99;
}
.card:hover .img-top {
display: inline;
}
<div class="card">
<img src="redlo.jpg" width="100" height="100" alt="first">
<img src="whitelo.jpg" class="img-top" width="100" height="100" alt="second">
</div>