我正试着让覆盖层淡入,但现在它是一个即时的变化
超文本:
<div class="image-container">
<img src="https://basicfishkeeping.com/wp-content/uploads/2023/01/Freshwater-Aquatic-Background-7.png" class="before">
<img src="https://basicfishkeeping.com/wp-content/uploads/2023/01/Freshwater-Aquatic-Background-8.png" class="after">
</div>
CSS:
.image-container {
position: relative;
width: 250px;
height: 250px;
}
.image-container .before {
width: 100%;
height: 100%;
}
.image-container .after {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
opacity: 0;
transition: 0.5s;
}
.image-container:hover .after {
display: block;
opacity: 1;
}
尝试在Wordpress上运行它,并立即更改为第二个图像,而不是淡入淡出
1条答案
按热度按时间c0vxltue1#
以下是渐入过渡: