Skip to content

Transit Line

A copy-paste maps & locations component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Maps & LocationsHTMLCSSany framework
  • Central
  • Park
  • Market
  • Harbor

Copy into your project

HTML
<div class="nuda-ml2-transit">
  <div class="nuda-ml2-transit__line" aria-hidden="true">
    <span class="nuda-ml2-transit__station" style="left:0%"></span>
    <span class="nuda-ml2-transit__station" style="left:33%"></span>
    <span class="nuda-ml2-transit__station" style="left:66%"></span>
    <span class="nuda-ml2-transit__station" style="left:100%"></span>
    <span class="nuda-ml2-transit__train"></span>
  </div>
  <ul class="nuda-ml2-transit__labels">
    <li>Central</li>
    <li>Park</li>
    <li>Market</li>
    <li>Harbor</li>
  </ul>
</div>
CSS
.nuda-ml2-transit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 240px;
  max-width: 100%;
}

.nuda-ml2-transit__line {
  position: relative;
  width: 240px;
  height: 16px;
}

.nuda-ml2-transit__line::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 2px;
  background: rgba(255,255,255,.15);
  transform: translateY(-50%);
}

.nuda-ml2-transit__station {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #161616;
  border: 2px solid #63636e;
  transform: translate(-50%,-50%);
  z-index: 1;
}

.nuda-ml2-transit__train {
  position: absolute;
  top: 50%;
  left: 6px;
  width: 20px;
  height: 10px;
  border-radius: 3px;
  background: #e4ff54;
  box-shadow: 0 0 8px rgba(228,255,84,.6);
  transform: translate(0,-50%);
  animation: _nuda-ml2transit-move 6s ease-in-out infinite;
  z-index: 2;
}

.nuda-ml2-transit__labels {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 10px;
  color: #777;
}

@keyframes _nuda-ml2transit-move {
  0%,8% {
    transform: translate(0,-50%);
  }
  25%,33% {
    transform: translate(76px,-50%);
  }
  50%,58% {
    transform: translate(152px,-50%);
  }
  75%,83% {
    transform: translate(224px,-50%);
  }
  100% {
    transform: translate(0,-50%);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-ml2-transit__train {
    animation: none !important;
    transform: translate(0,-50%);
  }
}

How to use Transit Line

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More maps & locations components

← Browse all NudaUI components