Entry 03
Press feedback
Use it on every button and anything else that can be pressed.
Code
.button:active { transform: scale(0.97); }
@media (prefers-reduced-motion: no-preference) {
.button { transition: transform 160ms var(--ease-out, ease-out); }
}Why it works, the rules and the credits
Why it works
- A native button responds the instant a finger lands.
:activedoes the same on every kind of input. Feedback that waits forclickarrives when the finger leaves, and that reads as lag. scale()shrinks the label and icon along with the button, so the whole control reads as pressed.
Rules
- Keep the scale between 0.95 and 0.98.
- The reset removes the browser's tap highlight. Without this entry a tap gives no feedback at all.
- When feedback needs a script, listen for
pointerdown, notclick.
Support
Every browser.
Credits
Borrowed from: Emil Kowalski, emil-design-eng skill and mobile-native skill