Back to CSS Progress Bars Goal Tracker Pure CSS
Share
HTML
<div
  class="pb-goal"
  role="progressbar"
  aria-valuenow="6800"
  aria-valuemin="0"
  aria-valuemax="10000"
  aria-label="Funds raised"
  style="--pb-goal-pct: 68%"
>
  <div class="pb-goal-track">
    <div class="pb-goal-fill"></div>
    <ul class="pb-goal-marks" aria-hidden="true">
      <li style="--m: 100%"><span>$10k</span></li>
      <li style="--m: 50%" class="hit"><span>$5k</span></li>
      <li style="--m: 10%" class="hit"><span>$1k</span></li>
    </ul>
  </div>
  <div class="pb-goal-meta">
    <strong>$6,800</strong>
    <span>raised of <em>$10,000</em></span>
  </div>
</div>
CSS
.pb-goal {
  width: 200px;
  height: 200px;
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 16px;
  font-family: system-ui, sans-serif;
}

.pb-goal-track {
  position: relative;
  width: 12px;
  height: 100%;
  margin-left: 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.pb-goal-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--pb-goal-pct, 0%);
  background: linear-gradient(180deg, #ec4899, #f43f5e);
  border-radius: 6px;
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.5);
  transition: height 0.7s cubic-bezier(0.5, 0, 0.3, 1.2);
}

.pb-goal-marks {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pb-goal-marks li {
  position: absolute;
  right: -28px;
  bottom: var(--m);
  transform: translateY(50%);
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.04em;
  font-family: "JetBrains Mono", monospace;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s;
}

.pb-goal-marks li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #475569;
  margin-left: -28px;
  transition:
    background 0.3s,
    border-color 0.3s,
    box-shadow 0.3s;
}

.pb-goal-marks li.hit {
  color: #fbcfe8;
}

.pb-goal-marks li.hit::before {
  background: #ec4899;
  border-color: #f9a8d4;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.7);
}

.pb-goal-meta {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  color: #f0eeff;
}

.pb-goal-meta strong {
  font-size: 22px;
  font-weight: 700;
  color: #fda4af;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.pb-goal-meta span {
  font-size: 11px;
  color: #94a3b8;
}

.pb-goal-meta em {
  font-style: normal;
  color: #fda4af;
  font-weight: 600;
}