Skip to content

Dashed March

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

Borders & OutlinesHTMLCSSany framework
Marching Ants

Copy into your project

HTML
<div class="nuda-dashed-march">
  Your content here
</div>
CSS
/* Dashed March
   Marching ants dashed border.
   Customize: --march-color, dash size */

.nuda-dashed-march {
  --march-color: #6366f1;
  position: relative;
  border-radius: 12px;
  background: #111;
  padding: 24px 32px;
}

.nuda-dashed-march::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    repeating-linear-gradient(90deg, var(--march-color) 0, var(--march-color) 6px, transparent 6px, transparent 12px) top / 100% 1.5px no-repeat,
    repeating-linear-gradient(0deg, var(--march-color) 0, var(--march-color) 6px, transparent 6px, transparent 12px) right / 1.5px 100% no-repeat,
    repeating-linear-gradient(90deg, var(--march-color) 0, var(--march-color) 6px, transparent 6px, transparent 12px) bottom / 100% 1.5px no-repeat,
    repeating-linear-gradient(0deg, var(--march-color) 0, var(--march-color) 6px, transparent 6px, transparent 12px) left / 1.5px 100% no-repeat;
  animation: nuda-march-move 1s linear infinite;
}

@keyframes nuda-march-move {
  to {
    background-position:
      12px top,
      right 12px,
      calc(100% - 12px) bottom,
      left calc(100% - 12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-dashed-march::before { animation: none; }
}

How to use Dashed March

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 borders & outlines components

← Browse all NudaUI components