HTML/CSS micro-interactions

4 examples. Micro-interactions built with CSS. Small, focused animations that respond to a single action: a like that bursts, a toggle that squishes, a field that confirms. Every example comes with a prompt your AI coding tool can rebuild.

HTML/CSS micro-interactions: common questions

How do I build micro-interactions in HTML/CSS?
Pick an example below, copy its prompt (or send it to Claude Code, Cursor or Codex) and your agent builds it in HTML/CSS. Each prompt lists the layout, timing and easing, and links a keyframe sheet of the motion. Yes. Transitions and @keyframes on transform and opacity run on the compositor, scroll-driven animations (animation-timeline) handle scroll effects, and the View Transitions API animates between states without JavaScript libraries.
What is a micro-interaction?
A micro-interaction is a small animated response to one user action, such as liking a post, toggling a setting or submitting a field. It confirms the action happened and makes the interface feel alive.
How long should a micro-interaction last?
Most feel right between 150 and 400 ms. Use springs for physical moves, keep the motion local to the control, and offer a reduced-motion version.

Micro-interactions in other frameworks

More HTML/CSS animations