Unit 4 ยท Seasonal Calendar
Stage 5 of 7
Unit 4 ยท Stage 5
Your season cards from Stage 4 already lift and change color when you hover. But try it now: the card snaps instantly from one state to the other, with no motion in between. In this stage you smooth that change with the CSS transition property, so it animates instead of jumping. Play in the editor, or press ๐ Type it with me to be guided. (pause on a highlighted word to see what it does)
:hover. That works, but it happens in a single instant. A transition tells the browser to animate the change over time instead of switching all at once.In the real world things move. They slide, speed up, and slow down. A hover that snaps instantly feels abrupt because nothing in nature jumps between two states. The CSS transition property brings that sense of motion to your page by animating the change between states instead of switching immediately.
transition: property duration timing-functiontransition: transform 0.3s easeFind your .season rule in the editor and add a transition line to it. One important detail: the transition must live on the base element, not on the :hover state. If you put it only on :hover, the animation plays going in but snaps back instantly on the way out. Putting it on the base element animates both directions.
transition: all 0.3s easeall is a shorthand that covers every animatable property (background-color, transform, box-shadow) so you do not have to name each one.0.3seaseease starts quick and slows near the end, like a car pulling into a parking spot. It feels natural because real objects rarely move at a perfectly constant speed.transition: all 0.3s ease; to your .season rule (the base rule, not :hover). Use the example below, then press โถ Run and hover a card..season {
padding: 24px 20px;
border-radius: 10px;
min-height: 280px;
cursor: pointer;
transition: all 0.3s ease;
}
What CSS property makes a hover change animate smoothly instead of snapping? Type it, then press Submit to unlock the last steps.
The timing function is worth experimenting with. Change ease to each value below one at a time, then hover a card to feel the difference.
linearease-inease-outease.ease-in-outMost designers use ease or ease-out for hover effects. Change yours back to ease after testing.
Using all is convenient, but you can also name properties one by one. That lets you give each change its own duration for finer control.
transition: transform 0.3s ease, ...background-color runs at 0.4s while the lift and shadow run at 0.3s, so the color trails just behind the movement for a layered feel.all 0.3s ease.season {
/* ...other properties... */
transition: transform 0.3s ease,
background-color 0.4s ease,
box-shadow 0.3s ease;
}
Spend a few minutes experimenting, then set it back the way you like it.
0.3s to 0.6s, then a fast one at 0.15s.ease for ease-out and notice how the cards feel slightly more responsive.all 0.3s ease before moving to Stage 6.To complete Stage 5, your .season rule needs a transition so the hover animates smoothly. Press Check my work when you are ready. This opens Stage 6 and lets your teacher see that you finished. In Stage 6 you replace the example content with seasonal knowledge from your own Tribal community.