← All Examples

Numeric Stepper

A styled <input type="number"> with custom spin button appearance using CSS pseudo-elements.

Published May 29, 2026

Demo

HTML

<div class="stepper-row">
  <button class="step-btn" onclick="this.nextElementSibling.stepDown()"></button>
  <input type="number" value="1" min="0" max="99">
  <button class="step-btn" onclick="this.previousElementSibling.stepUp()">+</button>
</div>

CSS

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  text-align: center;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

How it works

The native number input can be restyled by removing default spinners with appearance: textfield (or -moz-appearance: textfield for Firefox) and hiding the WebKit spin buttons via ::-webkit-inner-spin-button. A custom stepper UI wraps the input with styled +/− <button> elements and JavaScript to increment/decrement — or for a pure-CSS range approach, use <input type=range> styled with the same techniques.