30 CSS Badges05 / 30

CSS + JSMIT licensed

Transit Line Indicator

Wayfinding distilled. Bullet, name, live arrival, and a strip showing where you are on the line. Built to be read from across a platform — and the next-arrival time keeps counting down.

Published

Live Demo
Try it

The code

<div class="bdg-05-stage">
  <div class="bdg-05-platform">
    <div class="bdg-05-row">
      <div class="bdg-05-bullet">M7</div>
      <div>
        <div class="bdg-05-line">Northbrook Express</div>
        <div class="bdg-05-via">via Riverside · skip-stop after 18:00</div>
      </div>
      <div class="bdg-05-live">
        <span class="bdg-05-live-dot"></span>
        <span class="bdg-05-live-text">Next in <strong id="bdg-05-live-time">4 min</strong></span>
      </div>
    </div>

    <div class="bdg-05-route">
      <div class="bdg-05-route-line"></div>
      <div class="bdg-05-route-stops">
        <div class="bdg-05-stop bdg-05-stop-active"><span class="bdg-05-stop-label">Central</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">Park</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">9th Ave</span></div>
        <div class="bdg-05-stop bdg-05-stop-transfer"><span class="bdg-05-stop-label">Riverside</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">Northbrook</span></div>
      </div>
    </div>

    <div class="bdg-05-footer">
      <span>EASTBOUND · PLATFORM 3</span>
      <span>SVC OK</span>
    </div>
  </div>
</div>
.bdg-05-stage {
  background: #d9d3c4;
  padding: 50px 36px;
  background-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.06) 100%), linear-gradient(0deg, rgba(0,0,0,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 100% 100%, 60px 30px, 60px 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
}

.bdg-05-platform {
  background: linear-gradient(180deg, #15171a 0%, #0c0e10 100%);
  padding: 28px 26px 26px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 30px 60px -22px rgba(0,0,0,0.7), 0 6px 16px -2px rgba(0,0,0,0.4);
  color: #fff;
  position: relative;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.bdg-05-platform::before {
  content: 'M  T  A · LIVE';
  position: absolute;
  top: -12px;
  left: 0;
  background: #1a1a1a;
  padding: 4px 12px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: #c8102e;
}

.bdg-05-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px dashed rgba(255,255,255,0.18);
}

.bdg-05-bullet {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d4233d 0%, #b80e25 100%);
  color: #fff;
  font-family: "Bebas Neue", system-ui, sans-serif;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
  box-shadow: inset 0 -4px 6px rgba(0,0,0,0.35), inset 0 4px 5px rgba(255,255,255,0.25), 0 6px 14px rgba(200,16,46,0.5);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bdg-05-line {
  font-family: "Bebas Neue", system-ui, sans-serif;
  font-size: 26px;
  letter-spacing: 0.03em;
  line-height: 1;
  margin-bottom: 5px;
}

.bdg-05-via {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
}

.bdg-05-live {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.04);
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 2px;
}

.bdg-05-live-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 7px #4ade80;
  animation: bdg-05-pulse 1.6s infinite;
}

@keyframes bdg-05-pulse {
  0%,
    100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bdg-05-live-dot {
    animation: none;
  }
}

.bdg-05-live-text {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}

.bdg-05-live-text strong {
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}

.bdg-05-route {
  margin-top: 22px;
  position: relative;
  padding: 0 4px;
}

.bdg-05-route-line {
  position: absolute;
  top: 7px;
  left: 4px;
  right: 4px;
  height: 4px;
  background: #c8102e;
  border-radius: 2px;
}

.bdg-05-route-stops {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: relative;
  z-index: 1;
}

.bdg-05-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.bdg-05-stop::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 3px solid #c8102e;
  margin-bottom: 8px;
  transition: transform 0.2s;
}

.bdg-05-stop:hover::before {
  transform: scale(1.2);
}

.bdg-05-stop-active::before {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 2px #c8102e;
}

.bdg-05-stop-transfer::before {
  background: #fff;
  box-shadow: 0 0 0 2px #c8102e;
}

.bdg-05-stop-label {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
}

.bdg-05-stop-active .bdg-05-stop-label {
  color: #fff;
}

.bdg-05-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
// Next arrival countdown — decrements every 4s, resets to 5 min when
// it bottoms out so the demo never goes stale.
(function () {
  var nextIn = 4;
  var liveTimeEl = document.getElementById('bdg-05-live-time');
  if (!liveTimeEl) return;
  setInterval(function () {
    nextIn = nextIn > 1 ? nextIn - 1 : 5;
    liveTimeEl.textContent = nextIn + ' min';
  }, 4000);
})();
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS Badge from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Transit Line Indicator
Source: https://codefronts.com/snippets/css-badges/transit-line-indicator/

Wayfinding distilled. Bullet, name, live arrival, and a strip showing where you are on the line. Built to be read from across a platform — and the next-arrival time keeps counting down.
## HTML
```html
<div class="bdg-05-stage">
  <div class="bdg-05-platform">
    <div class="bdg-05-row">
      <div class="bdg-05-bullet">M7</div>
      <div>
        <div class="bdg-05-line">Northbrook Express</div>
        <div class="bdg-05-via">via Riverside · skip-stop after 18:00</div>
      </div>
      <div class="bdg-05-live">
        <span class="bdg-05-live-dot"></span>
        <span class="bdg-05-live-text">Next in <strong id="bdg-05-live-time">4 min</strong></span>
      </div>
    </div>

    <div class="bdg-05-route">
      <div class="bdg-05-route-line"></div>
      <div class="bdg-05-route-stops">
        <div class="bdg-05-stop bdg-05-stop-active"><span class="bdg-05-stop-label">Central</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">Park</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">9th Ave</span></div>
        <div class="bdg-05-stop bdg-05-stop-transfer"><span class="bdg-05-stop-label">Riverside</span></div>
        <div class="bdg-05-stop"><span class="bdg-05-stop-label">Northbrook</span></div>
      </div>
    </div>

    <div class="bdg-05-footer">
      <span>EASTBOUND · PLATFORM 3</span>
      <span>SVC OK</span>
    </div>
  </div>
</div>
```
## CSS
```css
.bdg-05-stage {
  background: #d9d3c4;
  padding: 50px 36px;
  background-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.06) 100%), linear-gradient(0deg, rgba(0,0,0,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 100% 100%, 60px 30px, 60px 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
}

.bdg-05-platform {
  background: linear-gradient(180deg, #15171a 0%, #0c0e10 100%);
  padding: 28px 26px 26px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 30px 60px -22px rgba(0,0,0,0.7), 0 6px 16px -2px rgba(0,0,0,0.4);
  color: #fff;
  position: relative;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.bdg-05-platform::before {
  content: 'M  T  A · LIVE';
  position: absolute;
  top: -12px;
  left: 0;
  background: #1a1a1a;
  padding: 4px 12px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: #c8102e;
}

.bdg-05-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px dashed rgba(255,255,255,0.18);
}

.bdg-05-bullet {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d4233d 0%, #b80e25 100%);
  color: #fff;
  font-family: "Bebas Neue", system-ui, sans-serif;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
  box-shadow: inset 0 -4px 6px rgba(0,0,0,0.35), inset 0 4px 5px rgba(255,255,255,0.25), 0 6px 14px rgba(200,16,46,0.5);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bdg-05-line {
  font-family: "Bebas Neue", system-ui, sans-serif;
  font-size: 26px;
  letter-spacing: 0.03em;
  line-height: 1;
  margin-bottom: 5px;
}

.bdg-05-via {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
}

.bdg-05-live {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.04);
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 2px;
}

.bdg-05-live-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 7px #4ade80;
  animation: bdg-05-pulse 1.6s infinite;
}

@keyframes bdg-05-pulse {
  0%,
    100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bdg-05-live-dot {
    animation: none;
  }
}

.bdg-05-live-text {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}

.bdg-05-live-text strong {
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}

.bdg-05-route {
  margin-top: 22px;
  position: relative;
  padding: 0 4px;
}

.bdg-05-route-line {
  position: absolute;
  top: 7px;
  left: 4px;
  right: 4px;
  height: 4px;
  background: #c8102e;
  border-radius: 2px;
}

.bdg-05-route-stops {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: relative;
  z-index: 1;
}

.bdg-05-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.bdg-05-stop::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 3px solid #c8102e;
  margin-bottom: 8px;
  transition: transform 0.2s;
}

.bdg-05-stop:hover::before {
  transform: scale(1.2);
}

.bdg-05-stop-active::before {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 2px #c8102e;
}

.bdg-05-stop-transfer::before {
  background: #fff;
  box-shadow: 0 0 0 2px #c8102e;
}

.bdg-05-stop-label {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
}

.bdg-05-stop-active .bdg-05-stop-label {
  color: #fff;
}

.bdg-05-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
```

## JavaScript
```js
// Next arrival countdown — decrements every 4s, resets to 5 min when
// it bottoms out so the demo never goes stale.
(function () {
  var nextIn = 4;
  var liveTimeEl = document.getElementById('bdg-05-live-time');
  if (!liveTimeEl) return;
  setInterval(function () {
    nextIn = nextIn > 1 ? nextIn - 1 : 5;
    liveTimeEl.textContent = nextIn + ' min';
  }, 4000);
})();
```

How this works

A subway-map-style route indicator: a coloured circle with the line letter/number inside and a status pill next to it — Uptown Local, Downtown Express, Delayed, Normal Service. Modelled on NYC MTA, London TfL, Paris RATP, Tokyo Metro real-time service badges.

The JS layer swaps between service states (Normal / Delayed / Suspended) on a timer, updating the pill's colour and text — the pattern real-time transit apps like Citymapper, Transit, and Moovit use to show live line status.

Make it yours

  • Rebrand the line circle colour per route — every transit system uses distinct hues that riders memorise (NYC 1/2/3 red, 4/5/6 green, 7 purple, N/Q/R/W yellow, etc.).
  • Change the status pill's colour and text — data-status="normal|delayed|suspended|planned" drives the CSS state.
  • Swap the line character for the actual route letter/number.
  • Add an alert icon (▲ or ⚠) for delayed status via ::before content.
  • Scale the badge for header vs inline use — the whole thing scales via font-size since dimensions use em units.

Gotchas — read before shipping

  • Colour is not the only signal — WCAG requires status to be conveyed by more than colour alone. Pair the colour with a text label (&ldquo;Delayed&rdquo; not just red).
  • The status pill needs aria-live="polite" if it updates dynamically, so screen readers announce service changes.
  • Real transit line colours are trademarked in some jurisdictions — check licensing before shipping a Metro or Tube-branded product.
  • Test at 320px viewport — the pill + circle combo can overflow if the status text is long (&ldquo;Suspended for maintenance&rdquo;), so allow text wrap or truncation.

Browser support

ChromeSafariFirefoxEdge
45+9+16+45+

CSS grid / flex, custom properties, and transitions are universally supported. The vanilla JS state swap is standard setTimeout.

Techniques used in this demo

Search CodeFronts

Loading…