Unit 4 ยท Seasonal Calendar
Stage 4 of 7
Unit 4 ยท Stage 4
Your calendar looks good, but it is completely still. Nothing responds when you move the mouse across it. In this stage you make each season card come alive with the CSS :hover pseudo-class, so a card lifts and darkens the moment a user points at it. Play in the editor, or press ๐ Type it with me to be guided. (pause on a highlighted word to see what it does)
A pseudo-class is a keyword you add to a selector to style an element based on its STATE, not just what it is. :hover is the most common one. It means: apply these styles while the user's mouse is over this element.
:hoverselector:hover { ... }.season:hover.:focus applies while an input is selected, and :visited applies after a link has been clicked. Same idea, different states.Make sure the .season rule has cursor: pointer, then add a brand new .season:hover block below it that lifts the card and deepens its shadow.
cursor: pointertransform: translateY(-6px)translateY controls vertical motion, and a negative value moves up, so the card looks like it lifts off the page.box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25).season:hover rule inside your <style> tag, just below the .season rule. Use the example below, then press โถ Run and hover over a card..season {
... existing rules ...
cursor: pointer;
}
.season:hover {
transform: translateY(-6px);
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}
What pseudo-class did you add so a card reacts when the mouse is over it? Type it with the colon, then press Submit to unlock the last step.
The lift works, but every card still keeps its exact color while hovered. Add a hover rule for each season that swaps in a slightly darker shade of the same hue.
.spring:hover { background-color: #3d6b4a }.summer:hover, .fall:hover, .winter:hover<style> tag, then press โถ Run and hover over each card..spring:hover { background-color: #3d6b4a; }
.summer:hover { background-color: #ad881a; }
.fall:hover { background-color: #9a4f2a; }
.winter:hover { background-color: #2f4357; }
Hover over each card in the preview and watch it lift and darken. Then experiment, and set it back the way you like it.
translateY(-6px) to translateY(-12px) for a bigger lift, then try a smaller one.box-shadow.:hover with a colon, not a dot.To complete Stage 4, your cards need a .season:hover lift and a darker hover color for each season. Press Check my work when you are ready. This opens Stage 5 and lets your teacher see that you finished.