CSS Labeled Progress Bar

A determinate progress bar with a title, percentage and caption, like a storage usage meter.

  • determinate
  • storage
  • usage
  • percentage
  • quota
HTML
<div class="progress-labeled">
  <div class="progress-labeled-head"><span>Storage</span><span>72%</span></div>
  <div class="progress-labeled-track" style="--value: 72%" role="progressbar" aria-label="Storage used" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100"></div>
  <small>36 GB of 50 GB used</small>
</div>
CSS
.progress-labeled {
  display: grid;
  gap: 8px;
  width: min(100%, 280px);
  color: #18181b;
  font: 14px/1.3 system-ui, sans-serif;
}

.progress-labeled-head {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-labeled-track {
  --value: 0%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede9fe;
}

.progress-labeled-track::before {
  content: "";
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #6d28d9);
  transition: width 0.4s ease;
}

.progress-labeled small {
  color: #71717a;
  font-size: 12px;
}

About this CSS Labeled Progress Bar

This CSS Labeled Progress Bar is 37 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses transitions, linear gradients, CSS Grid and Flexbox. 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 labeled progress bar without touching the rest of the CSS:

PropertyDefault
--value0%

How to use this labeled progress bar

  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 .progress-labeled 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