A CSS transition makes a change happen gradually instead of all at once. Think of it as a gentle fade rather than a light switch: when an image overlay changes opacity, the browser animates that change. section 20.5
Fade in an overlay
Set the overlay to start invisible with opacity: 0, then use transition: opacity 1.5s ease. On hover, changing opacity to 1 fades the after image into view over the before image. section 20.5
.image-overlay {
position: absolute;
left: 0;
top: 0;
width: 200px;
height: 156px;
z-index: 1;
opacity: 0;
transition: opacity 1.5s ease;
}
.image-overlay:hover {
opacity: 1;
}
This CSS pairs an opacity change with a 1.5-second eased transition, then triggers the visible state on hover. section 20.5




