Skip to content

Cards That React to You

Intermediate~14 min0/4 steps

Animation & Interaction: Bring It to Life

Static pages feel dead. The moment a card lifts under your cursor or a button glows when you hover, a site feels crafted — and visitors trust crafted work.

The good news: you don't need JavaScript for most of this. Tailwind gives you hover states (hover:scale-105), transitions (transition duration-300) that make changes smooth instead of jarring, and even keyframe animations (animate-pulse, animate-bounce) for looping motion.

In this lesson you'll build an interactive card and button that respond to the mouse with a lift, a shadow, and a smooth color shift — the micro-interactions that separate a beginner page from a polished one.

Instructions

1

Create a card div with a smooth transition so any hover change animates instead of snapping.

Hint: Use: `<div class="bg-gray-800 rounded-2xl p-8 transition duration-300 cursor-pointer">` — transition is what makes movement smooth

Where does this go?

<!-- Build an interactive card with hover and transition effects -->

Write it on line 12 — under that comment, after the code you already added.

2

Make the card lift on hover by scaling it up slightly.

3

Add a small looping animation somewhere on the card using a keyframe utility.

4

Add a button that changes color and scales up on hover with a smooth transition.

Your Code

html
15 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Live Preview

Live Preview