# Segmented Progress Bar

> A progress bar split into equal blocks that fill up to a step count, for onboarding or quizzes.

- Category: [CSS Loaders & Spinners](https://copy-css.com/category/loaders)
- Tags: steps, blocks, onboarding, mask, custom property
- Live preview: https://copy-css.com/snippets/segmented-progress-bar
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="progress-segments" style="--value: 6" role="progressbar" aria-label="Step 6 of 10" aria-valuenow="6" aria-valuemin="0" aria-valuemax="10"></div>
```

## CSS

```css
.progress-segments {
  --value: 0;
  --segments: 10;
  --gap: 4px;
  width: min(100%, 260px);
  height: 12px;
  background: linear-gradient(
    90deg,
    #16a34a calc(var(--value) / var(--segments) * 100%),
    #d1fae5 0
  );
  /* Cut the bar into equal blocks with gaps between them */
  -webkit-mask: repeating-linear-gradient(
    90deg,
    #000 0 calc(100% / var(--segments) - var(--gap)),
    #0000 0 calc(100% / var(--segments))
  );
  mask: repeating-linear-gradient(
    90deg,
    #000 0 calc(100% / var(--segments) - var(--gap)),
    #0000 0 calc(100% / var(--segments))
  );
}
```

## Notes

- This CSS Segmented Progress Bar is 23 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses linear gradients, masks and custom properties.
- Customize with: `--value`, `--segments`, `--gap`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
