I currently have a set up with two images stacked on top of each other. I am looking to make the top image shrink after a timeout, not disappear completely but become a thumbnail size. As this top image shrinks, the bottom image will be revealed.
As someone with no experience in CSS animation, what would be the best approach for me to learn how to achieve the above effect?
<div class="block">
<div class="block__content">
<h3 class="title--s">
This is the title
</h3>
</div>
<div class="block__image product-sale">
<img src="/topimage" alt="topimage">
</div>
</div>
The product-sale class contains the styling for the thumbnail:
.product-sale {
&:before {
content: "text";
height: 53px;
padding: 10px;
background: red;
color: #fff;
font-weight: bolder;
position: absolute;
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
left: 30px;
font-size: 11px;
}
}
This is the code for the .block__image class:
.block__image {
min-width: 140px;
position: relative;
img {
width: 400px;
height: 200px;
-o-object-fit: cover;
object-fit: cover;
padding: 0px 30px 30px 30px;
}
}
One idea I have is to add a transition to the pseudo element. You can see an example of transitions on W3Schools.