Transition Example
suggest changeList the properties that should animate instead of using all:
.button {
transition:
color 160ms ease,
background-color 160ms ease,
transform 160ms ease;
}
.button:hover {
transform: translateY(-0.125rem);
}
@media (prefers-reduced-motion: reduce) {
.button {
transition: none;
}
}
Explicit property names prevent unrelated future changes from being animated accidentally. Transforms and opacity are usually good animation choices because they often avoid layout work, but performance still depends on the page and browser.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents