Loading...
Loading...
By continuing to use the platform, you accept the terms of the Privacy Policy and the use of cookies.
CSS provides two approaches for creating visual effects:
transition) — for simple effects (on hover, focus, etc.)@keyframes + animation) — for complex and multi-step effectsUsed for animating property changes when element state changes.
.button {
background: blue;
transition: background 0.3s ease;
}
.button:hover {
background: red;
}
transition-property — which property to animatetransition-duration — durationtransition-timing-function — easing functiontransition-delay — delay before startFor multi-step animations with full control.
@keyframes slideIn {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
.element {
animation: slideIn 1s ease-out;
}
animation-name — keyframes nameanimation-duration — durationanimation-timing-function — easinganimation-delay — delayanimation-iteration-count — repeat countanimation-direction — directionTip:
Use transition for simple effects, animation for complex multi-step animations.