How to build a button hover effect
A button that grows, tilts and lifts a shadow when the pointer passes over it.
Hover me
Steps
- Use transition on transform and box-shadow.
- Scale gently, 1.1 is enough.
- Do not forget a :focus-visible state for keyboards.
The code
.btn{transition:transform .2s ease,box-shadow .2s ease}
.btn:hover,.btn:focus-visible{transform:scale(1.1) rotate(-2deg);box-shadow:0 10px 30px rgba(255,94,26,.45)}Want ready-made variations? The library has hundreds, each with standalone code.