Home / Learn / How to build a button hover effect

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

  1. Use transition on transform and box-shadow.
  2. Scale gently, 1.1 is enough.
  3. 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.