CSS Animations โจ
Copy-paste ready HTML + CSS combos. Live previews. No dependencies.
About this tool
The CSS Animations library provides copy-paste ready HTML and CSS animation combinations with live previews. All animations use pure @keyframes with no JavaScript dependencies, no build tools, and no external libraries โ paste the code and it works. Categories include buttons, loaders, text effects, cards, backgrounds, and micro-interactions.
When to use it
- โAdding polished hover and loading animations without importing a library
- โBuilding animated UI components for prototypes and demos quickly
- โLearning CSS animation techniques by reading and modifying working examples
- โFinding inspiration for motion design in web interfaces
Tips
- โAdd animation-play-state: paused with a :hover selector to pause animations on hover.
- โUse @media (prefers-reduced-motion: reduce) to disable animations for users who have requested reduced motion in their OS settings.
- โCSS animations are GPU-accelerated when using transform and opacity โ avoid animating layout properties like width, height, or top.
Frequently asked questions
What is the difference between CSS transitions and CSS animations?
CSS transitions animate a property from one state to another when a trigger occurs (like :hover). They go in one direction with a start and end state. CSS animations use @keyframes to define multiple intermediate steps, can loop, can play automatically without a trigger, and offer full control over timing and direction.
Why should I prefer animating transform and opacity instead of layout properties?
Animating properties like width, height, top, or left triggers layout recalculation on every frame โ an expensive operation. Animating transform (translate, scale, rotate) and opacity is handled by the GPU compositor and does not touch the layout engine, resulting in smoother 60fps animations with far less CPU overhead.
How do I respect prefers-reduced-motion for accessibility?
Wrap motion-heavy styles in a media query: @media (prefers-reduced-motion: no-preference) { /* animation here */ }. Users who enable 'reduce motion' in their OS accessibility settings will not receive the animation. Alternatively, use @media (prefers-reduced-motion: reduce) to explicitly disable or slow down animations for those users.
How do I pause a CSS animation on hover?
Add animation-play-state: paused to the :hover rule of the animated element: .element:hover { animation-play-state: paused; }. This freezes the animation at its current frame and resumes from there when the cursor leaves.