Marching Ants

Outline & Stroke · Animated · pure CSS

The selection-marquee classic wrapped around your letters: a hollow text-stroke outline chopped into crisp diagonal dashes by a repeating-gradient mask, whose position animates so the dashes crawl forever like marching ants. Monochrome white-on-dark / black-on-light by default with an optional hue tint and a translucent inner fill so the hollow glyph reads intentional.

Marching Ants

How it works

Marching Ants is an animated outline & stroke text effect rendered entirely in CSS. A data-text attribute mirrors the word into ::before/::after layers, so copy that attribute together with the CSS.

Controls

Marching Ants exposes 4 dedicated controls — Dash, Speed, Tint and Hue — on top of the shared type controls (font, weight, letter-spacing and case). Open it in the generator to tune every value live, then copy the updated CSS.

CSS

/* Marching Ants — made with TEXT-FX · https://text-fx.app
 * HTML: the element needs a data-text attribute equal to its text.
 * Font: 'Space Grotesk', sans-serif (load from Google Fonts).
 */

.text-effect {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: none;
}

.text-effect {
  position: relative;
  display: inline-block;
  color: hsl(139 0% 95% / 0.28);
  -webkit-text-fill-color: hsl(139 0% 95% / 0.28);
}
.text-effect::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 3.5px hsl(139 0% 95%);
  filter: drop-shadow(0 0 1px hsl(139 0% 95%)) drop-shadow(0 0 6px hsl(139 0% 95% / 0.4));
  -webkit-mask-image: repeating-linear-gradient(45deg, #000 0, #000 10px, transparent 10px, transparent 16px);
          mask-image: repeating-linear-gradient(45deg, #000 0, #000 10px, transparent 10px, transparent 16px);
  -webkit-mask-size: 22.63px 22.63px;
          mask-size: 22.63px 22.63px;
  -webkit-mask-repeat: repeat;
          mask-repeat: repeat;
  -webkit-mask-position: 0 0;
          mask-position: 0 0;
  animation: text-effect-march 5.7s linear infinite;
}

@keyframes text-effect-march {
  to {
    -webkit-mask-position: 22.63px 0;
            mask-position: 22.63px 0;
  }
}

HTML

This effect needs the markup below (per-letter spans, SVG defs, or a data-text attribute).

<!-- Made with TEXT-FX · https://text-fx.app -->

<style>
.text-effect {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: none;
}

.text-effect {
  position: relative;
  display: inline-block;
  color: hsl(139 0% 95% / 0.28);
  -webkit-text-fill-color: hsl(139 0% 95% / 0.28);
}
.text-effect::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 3.5px hsl(139 0% 95%);
  filter: drop-shadow(0 0 1px hsl(139 0% 95%)) drop-shadow(0 0 6px hsl(139 0% 95% / 0.4));
  -webkit-mask-image: repeating-linear-gradient(45deg, #000 0, #000 10px, transparent 10px, transparent 16px);
          mask-image: repeating-linear-gradient(45deg, #000 0, #000 10px, transparent 10px, transparent 16px);
  -webkit-mask-size: 22.63px 22.63px;
          mask-size: 22.63px 22.63px;
  -webkit-mask-repeat: repeat;
          mask-repeat: repeat;
  -webkit-mask-position: 0 0;
          mask-position: 0 0;
  animation: text-effect-march 5.7s linear infinite;
}

@keyframes text-effect-march {
  to {
    -webkit-mask-position: 22.63px 0;
            mask-position: 22.63px 0;
  }
}
</style>

<div data-text="Your text" class="text-effect">Your text</div>
Category
Outline & Stroke
Type
Animated
Browser support
-webkit-text-stroke masked by an animated repeating-gradient (all modern, prefixed)
Capabilities
dataText

Related Outline & Stroke effects