# Filled Range Slider

> A thick range slider that fills with color up to the thumb in every browser, using a clipped box-shadow trick.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: range, slider, fill, progress, volume, no javascript
- Live preview: https://copy-css.com/snippets/filled-range-slider
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<label class="range-fill">
  <span>Volume</span>
  <input type="range" min="0" max="100" value="65">
</label>
```

## CSS

```css
.range-fill {
  --fill: #0284c7;
  display: grid;
  gap: 8px;
  width: 240px;
  color: #0c4a6e;
  font: 600 13px system-ui, sans-serif;
}

.range-fill input {
  height: 16px;
  margin: 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e0f2fe;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-fill input::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--fill);
  border-radius: 50%;
  background: #fff;
  box-shadow: -408px 0 0 400px var(--fill);
  -webkit-appearance: none;
  appearance: none;
}

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

.range-fill input::-moz-range-progress {
  height: 16px;
  background: var(--fill);
}

.range-fill input:focus-visible {
  outline: 2px solid var(--fill);
  outline-offset: 3px;
}
```

## Notes

- This CSS Filled Range Slider is 49 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses box shadows, CSS Grid, keyboard focus styles and custom properties.
- Customize with: `--fill`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
