About this snippet

Style the default browser range input with this modern CSS snippet. We remove the native appearance and apply a custom track and thumb design that looks consistent across Chrome, Safari, and Firefox.

Size
1.2 KB
Uses
HTML, CSS
Loads
Nothing external
Views
280
<div class="range-container">
  <label for="range">Volume Control</label>
  <input type="range" id="range" min="0" max="100" value="50" class="custom-range">
</div>
.range-container {
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  max-width: 300px;
  padding: 20px;
}
label {
  display: block;
  margin-bottom: 15px;
  font-weight: 600;
  color: #374151;
}
.custom-range {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}
/* Slider Thumb (Chrome/Safari) */
.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #dbeafe;
  transition: background .15s ease-in-out;
}
/* Slider Thumb (Firefox) */
.custom-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #dbeafe;
}
.custom-range::-webkit-slider-thumb:hover {
  background: #2563eb;
}
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save