# Tailwind CSS Animations & Transitions ## Basic Transitions ```html ``` ### Transition Properties | Class | Description | |-------|-------------| | `transition` | All properties | | `transition-colors` | Color properties only | | `transition-opacity` | Opacity only | | `transition-transform` | Transform only | | `duration-150` | 150ms duration | | `duration-300` | 300ms duration | | `ease-in` | Ease in timing | | `ease-out` | Ease out timing | | `ease-in-out` | Ease in-out timing | --- ## Transform Effects ```html
Scale on hover
Scale up and move up
``` --- ## Built-in Animations ```html
Spinning
Pulsing
Bouncing
Pinging (radar effect)
``` ### Common Use Cases ```html
``` --- ## Custom Animations (v4.1+) ```css /* In your CSS with @theme */ @theme { --animate-fade-in: fadeIn 0.5s ease-in-out; --animate-slide-up: slideUp 0.3s ease-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } ``` Usage: ```html
Fades in on load
Slides up on load
``` --- ## Motion Preferences Respect user's motion preferences: ```html
Doesn't animate when user prefers reduced motion
Only animates when motion is preferred
``` ### Global Reduced Motion Support ```css @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } } ```