← Cheat Sheets
CSS Transitions, Animations and Transforms
Motion in CSS.
# CSS Transitions, Animations and Transforms
Motion in CSS.
```css
.btn { transition: background-color 200ms ease, transform 200ms ease; }
.btn:hover { transform: translateY(-2px) scale(1.02); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.card { animation: fade-in 400ms ease-out both; }
/* animation: name duration timing-function delay iteration-count direction fill-mode */
/* Transform functions */
/* translate(x, y) rotate(45deg) scale(1.5) skew(10deg) */
@media (prefers-reduced-motion: reduce) {
* { animation: none !important; transition: none !important; }
}
```
Timing keywords: `linear`, `ease`, `ease-in`, `ease-out`, `ease-in-out`, or `cubic-bezier()`. Animate `transform` and `opacity` for smooth performance.