Home / Soft and Tactile UI / Tactile Buttons

Tactile Buttons CSS Template, Free with Live Demo

Free tactile 3D button template in pure CSS. Keys visibly press down when clicked. Includes a working calculator and shop page. Live demo and download. The example is Clack, a keyboard shop with a working calculator.

Open live demoDownload HTML fileView code on GitHub
Tactile Buttons CSS template example: Clack, a keyboard shop with a working calculator

What is tactile buttons?

Tactile buttons look like real keys that move when you press them. They have a thick colored edge underneath, and when you click, the top slides down to meet it. It makes every click feel satisfying.

The effect uses a solid box shadow as the side of the key, then moves the button down with transform on the active state while shrinking the shadow. It is fast, works everywhere and needs no JavaScript.

Good for

  • Call to action buttons that must be clicked
  • Games, quizzes and playful apps
  • Calculators, keypads and music pads
  • Online shops for physical products

What you get in this template

The key CSS

This is the part that makes the tactile buttons look work. Copy it into your own project.

.key {
  background: #f4f0e8;
  border-radius: 12px;
  box-shadow: 0 6px 0 #bdb4a5, 0 8px 12px rgba(0,0,0,.25);
  transition: transform .06s, box-shadow .06s;
}

.key:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #bdb4a5, 0 2px 4px rgba(0,0,0,.25);
}

How to use it

  1. Click Download HTML file above.
  2. Open the file in any code editor, like VS Code.
  3. Change the text, colors and links to match your project. Colors are at the top of the style tag.
  4. Upload it to any host, such as GitHub Pages, Netlify or your own server. It is one file with no build step.

Questions people ask

How do you make a 3D button that presses down in CSS?

Add a solid box shadow with no blur below the button, like 0 6px 0 a darker color. On :active, move the button down with transform: translateY(5px) and reduce the shadow to 1px. It looks like the key is being pushed in.

Does the press effect work on phones?

Yes. The :active state fires when you tap, so the key presses down under your finger.

Is the calculator code safe to use?

It only takes input from its own buttons, so no one can type code into it. For a real product you may still want a proper math parser.

More Soft and Tactile UI designs