CSS3
Transitions
Smoothly interpolate properties on state change.
By EZ4Code Team
transitionshover
Code
.button {
background: #1976d2;
color: #fff;
transition: background 0.3s ease, transform 0.2s ease;
}
.button:hover {
background: #1565c0;
transform: translateY(-2px);
}
/* Transition all changed properties (use sparingly) */
.card {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Stagger via transition-delay */
.list li {
transition: opacity 0.3s;
transition-delay: calc(var(--i) * 50ms);
}Explanation
Transitions smoothly interpolate a property's value between its start and end states. Specifying which properties transition (rather than all) avoids unexpected animation. cubic-bezier customizes easing, and transition-delay can stagger effects across elements.
More CSS3 Snippets
Flexbox Layout
Align and distribute items along one axis with flexbox.
Grid Layout
Build two-dimensional layouts with grid-template-areas.
Animations
Define keyframes and apply reusable animations.
2D & 3D Transforms
Translate, rotate, and scale elements with GPU-friendly transforms.
Media Queries
Apply responsive, print, and preference-based styles.
Custom Properties
Define and reuse CSS variables with live updates.