Distance Line
A copy-paste maps & locations component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Maps & LocationsHTMLCSSany framework
2.4 km
Copy into your project
HTML
<div class="nuda-dline">
<span class="nuda-dline__a"></span>
<span class="nuda-dline__line"></span>
<span class="nuda-dline__b"></span>
<span class="nuda-dline__chip">2.4 km</span>
</div>CSS
.nuda-dline {
position: relative;
display: inline-flex;
align-items: center;
justify-content: space-between;
width: 200px;
height: 40px;
padding: 0 4px;
}
.nuda-dline__a,.nuda-dline__b {
width: 12px;
height: 12px;
border-radius: 50%;
flex-shrink: 0;
z-index: 1;
}
.nuda-dline__a {
background: #62b6ff;
box-shadow: 0 0 0 3px rgba(98,182,255,.2);
}
.nuda-dline__b {
background: #e4ff54;
box-shadow: 0 0 0 3px rgba(228,255,84,.2);
}
.nuda-dline__line {
position: absolute;
left: 8px;
right: 8px;
top: 50%;
transform: translateY(-50%);
height: 1px;
background: repeating-linear-gradient(90deg,#fafafa 0,#fafafa 4px,transparent 4px,transparent 8px);
opacity: .4;
animation: _dlineFlow 1.4s linear infinite;
}
.nuda-dline__chip {
position: absolute;
left: 50%;
top: -2px;
transform: translateX(-50%);
padding: 2px 8px;
background: #0c0c10;
border: 1px solid #e4ff54;
border-radius: 99px;
font-size: 10px;
font-weight: 700;
color: #e4ff54;
font-variant-numeric: tabular-nums;
animation: _dchipBob 2.4s ease-in-out infinite;
}
@keyframes _dlineFlow {
from {
background-position: 0 0;
}
to {
background-position: 8px 0;
}
}
@keyframes _dchipBob {
0%,100% {
transform: translateX(-50%) translateY(0);
}
50% {
transform: translateX(-50%) translateY(-2px);
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-dline__line,.nuda-dline__chip {
animation: none;
}
}
How to use Distance 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.