Chapter practice task
Task: Add polished hover effects and one entrance animation
- Give all your buttons a smooth hover and a visible keyboard focus style.
- Add a lift-and-shadow hover to your service cards.
- Animate your hero headline so it fades and slides in on page load.
- Style your form fields with
:focusand:invalid. - Turn off animations for visitors who prefer reduced motion.
By the end of this chapter
- You can add smooth transitions to any property change
- You can build keyframe animations and control their timing
- You can use pseudo-classes and pseudo-elements for hover, focus and decoration
Quick answers for this chapter
Transition or animation?
A transition animates a change (like hover). An animation runs on its own, using keyframes.
Do animations hurt performance?
Not if you animate transform and opacity. Avoid animating width, height and margins.
Do hover effects work on phones?
There’s no real hover on touch screens, so never hide important content behind a hover.