CSS Filled Range Slider

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

  • range
  • slider
  • fill
  • progress
  • volume
  • no javascript
HTML
<label class="range-fill">
  <span>Volume</span>
  <input type="range" min="0" max="100" value="65">
</label>
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;
}

About this CSS Filled Range Slider

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. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

Change these custom properties to restyle the filled range slider without touching the rest of the CSS:

PropertyDefault
--fill#0284c7

How to use this filled range slider

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .range-fill class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback