# Price Range Slider

> A dual-handle price filter built from two stacked range inputs where only the thumbs catch the pointer.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: dual range, min max, price filter, two thumbs, slider, ecommerce
- Live preview: https://copy-css.com/snippets/price-range-slider
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<fieldset class="price-range">
  <legend>Price</legend>
  <div class="price-range-track">
    <input type="range" min="0" max="500" step="10" value="80" aria-label="Minimum price">
    <input type="range" min="0" max="500" step="10" value="360" aria-label="Maximum price">
  </div>
  <p><span>$0</span><span>$500</span></p>
</fieldset>
```

## CSS

```css
.price-range {
  --thumb: 20px;
  width: 260px;
  margin: 0;
  padding: 0;
  border: 0;
  color: #4a044e;
  font-family: system-ui, sans-serif;
}

.price-range legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.price-range-track {
  position: relative;
  height: var(--thumb);
}

.price-range-track::before {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(var(--thumb) / 2);
  left: calc(var(--thumb) / 2);
  height: 4px;
  border-radius: 999px;
  background: #f5d0fe;
  transform: translateY(-50%);
}

.price-range input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: var(--thumb);
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

.price-range input::-webkit-slider-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: #c026d3;
  box-shadow: 0 0 0 4px #fff, 0 2px 6px 4px rgba(112, 26, 117, 0.25);
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  cursor: grab;
}

.price-range input::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: #c026d3;
  box-shadow: 0 0 0 4px #fff, 0 2px 6px 4px rgba(112, 26, 117, 0.25);
  pointer-events: auto;
  cursor: grab;
}

.price-range input:focus-visible {
  outline: none;
}

.price-range input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px #c026d3;
}

.price-range input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px #c026d3;
}

.price-range p {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 0;
  color: #a21caf;
  font-size: 12px;
}
```

## Notes

- This CSS Price Range Slider is 89 lines of pure CSS (1.7 KB) with no JavaScript and no dependencies. It uses transforms, box shadows, 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.
