CSS3
Animations
Define keyframes and apply reusable animations.
By EZ4Code Team
animationskeyframes
Code
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-30px); }
}
.ball {
animation: bounce 1s ease-in-out infinite;
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/* Pause on hover */
.ball:hover {
animation-play-state: paused;
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
.fade { animation: fade-in 0.5s ease forwards; }Explanation
@keyframes define intermediate states of an animation as percentages from 0% to 100%. The animation shorthand sets duration, timing, iteration count, and direction in one declaration. Use animation-play-state to pause or resume, and forwards to retain the end state.
More CSS3 Snippets
Flexbox Layout
Align and distribute items along one axis with flexbox.
Grid Layout
Build two-dimensional layouts with grid-template-areas.
Transitions
Smoothly interpolate properties on state change.
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.