# Range Slider with Ticks

> A stepped range slider that snaps to five values, with tick marks and labels drawn under the track.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: range, slider, ticks, steps, scale labels, input
- Live preview: https://copy-css.com/snippets/range-slider-ticks
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<label class="range-ticks">
  <span>Team size</span>
  <input type="range" min="0" max="4" step="1" value="2">
  <span class="range-ticks-scale" aria-hidden="true">
    <span>1</span><span>5</span><span>10</span><span>25</span><span>50+</span>
  </span>
</label>
```

## CSS

```css
.range-ticks {
  --thumb: 20px;
  display: grid;
  gap: 8px;
  width: 260px;
  color: #422006;
  font: 600 13px system-ui, sans-serif;
}

.range-ticks input {
  width: 100%;
  height: var(--thumb);
  margin: 0;
  background:
    linear-gradient(#fde68a, #fde68a) center / calc(100% - var(--thumb)) 4px no-repeat,
    repeating-linear-gradient(90deg, #ca8a04 0 2px, transparent 0 calc((100% - 2px) / 4)) calc(var(--thumb) / 2 - 1px) 100% / calc(100% - var(--thumb) + 2px) 6px no-repeat;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-ticks input::-webkit-slider-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 3px solid #ca8a04;
  border-radius: 50%;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.range-ticks input::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border: 3px solid #ca8a04;
  border-radius: 50%;
  background: #fff;
}

.range-ticks input:focus-visible {
  outline: 2px solid #ca8a04;
  outline-offset: 4px;
}

.range-ticks-scale {
  display: flex;
  justify-content: space-between;
  margin: 0 calc(var(--thumb) / 2 - 8px);
  color: #a16207;
  font-size: 11px;
  font-weight: 500;
}

.range-ticks-scale span {
  width: 16px;
  text-align: center;
}
```

## Notes

- This CSS Range Slider with Ticks is 58 lines of pure CSS (1.3 KB) with no JavaScript and no dependencies. It uses linear gradients, CSS Grid, Flexbox and keyboard focus styles.
- Customize with: `--thumb`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
