UNIT 10 • STAGE 4 OF 7
Make the cards lift, scale, and glow when a visitor hovers over them
The hover effect you are about to build has three parts working together. Each one adds a different quality to the interaction:
transform: translateY(-6px) moves the card 6 pixels upward, creating the illusion it is rising off the page. A warm gold box shadow fades in beneath it.transform: scale(1.06) makes the dancer illustration grow slightly. Since the card has overflow: hidden, the edges clip and it looks like the image is zooming in from within the card.::before pseudo-element sits over the card as an invisible gold tint. On hover, its opacity transitions from 0 to 1, washing the card in a warm glow.Hover over the right card below to see all three working at once:
Find the .dancer-card rule and add transition to it. Then add the five new rules below it, all just above </style>:
Also update .card-label, change its z-index from 1 to 2 so it stays above the new ::before overlay:
transition: transform 0.3s ease, box-shadow 0.3s ease on .dancer-card, tells the browser to animate both the lift and the shadow over 300 milliseconds with an ease curve. Without this, both changes would snap instantly on hover.transform: translateY(-6px) on hover, moves the card upward by 6 pixels. The movement is purely visual and does not affect the layout of other elements around it.box-shadow: 0 16px 48px rgba(212, 168, 83, 0.25), a large soft shadow in a warm gold tone. The 0 horizontal offset centers it. 16px vertical offset pushes it down. 48px blur spreads it wide. 0.25 opacity keeps it subtle.transform: scale(1.06) on hover image, scales the image to 106% of its size. The overflow: hidden on the card clips the excess, so the image appears to zoom in from within the card frame.::before pseudo-element, creates a generated element that acts as an invisible overlay layer. It occupies the full card area via inset: 0 (a shorthand for setting all four sides to 0). At opacity: 0 it is invisible; at opacity: 1 on hover it becomes a warm gold tint.z-index: 2 on .card-label, keeps the dance name readable above the ::before overlay, which sits at z-index: 1.Your cards now respond to hover with a lift, a zoom, and a gold glow. In Stage 5 you will build the modal, the popout window that will appear when a visitor clicks a card. The modal is all HTML and CSS in this stage. JavaScript comes in Stage 6.