On this page
transition
Prev: `opacity` | Up: motion | Next: `animation`
Rel: motion, Custom Properties & Animation Guide
Ref: MDN Web Docs — transition
Tags: #public #web #css #properties #motion #tier/core
Syntax & Overview
transition: transform 150ms ease, opacity 150ms ease;
Smoothly interpolates property changes between states.
- Initial:
all 0s ease 0s| Inherited: No | Animatable: No
Notes & Best Practices
- Never write
transition: all: List exact properties (transform,opacity,background-color) so unrelated layout changes don't animate accidentally.
Example
.btn {
transition: background-color 150ms ease, transform 120ms ease;
}
.btn:active { transform: scale(0.98); }
Linked from
Related notes
- tuts/css/properties/motion/animation Linked here; links to this page; shared tags: #css, #motion, #properties, #tier, #web
- tuts/css/properties/motion/opacity Linked here; links to this page; shared tags: #css, #motion, #properties, #tier, #web
- tuts/css/properties/motion Linked here; links to this page; shared tags: #css, #motion, #properties, #web
- tuts/css/properties/custom_properties_and_animation Linked here; shared tags: #css, #properties, #web
- tuts/css/properties/motion/transform shared tags: #css, #motion, #properties, #tier, #web
- tuts/css/properties/motion/will-change shared tags: #css, #motion, #properties, #tier, #web
- tuts/css/properties/box_model/aspect-ratio shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/box-sizing shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/inline-size shared tags: #css, #properties, #tier, #web
- tuts/css/properties/box_model/margin shared tags: #css, #properties, #tier, #web