How to Animate a Filled SVG Logo With a CSS Draw-On Effect

Most logos are filled shapes, not lines, so a standard stroke-dasharray animation shows nothing or looks wrong. Here are three ways to fix that, with the CSS for each and a checklist to work out which one your logo needs.

You followed a "draw your logo with CSS" tutorial, pasted in the code and got nothing. Or the logo flashed in all at once. Or you got a thin outline crawling around the edges of each letter instead of the letters writing themselves.

The usual reason is that your logo is made of fills, not strokes. The draw-on trick animates the stroke (the line along a path). Most logos exported from Illustrator, Figma, Canva or a logo maker have no stroke at all. They are solid shapes with a fill color. This guide covers how to check your file, the three ways to animate a filled logo, and the CSS for each.

Step 1: Check what your logo is made of

Open your .svg file in a text editor such as VS Code, Notepad or TextEdit in plain-text mode. Look at the drawing elements, which are usually path, but can also be rect, circle, polygon or text.

Step 2: Prepare the file (do this whatever method you choose)

  1. Convert text to outlines. In Illustrator use Type > Create Outlines. In Inkscape use Path > Object to Path. In Figma, select the text and use Flatten. Don't use Outline Stroke, which does something different: it turns strokes into fills.
  2. Decide on compound paths. A path can hold several separate shapes, such as every letter of a word in one path. CSS treats that path as one long line, so the shapes draw one after another, in whatever order the file stores them. If you want the letters to draw at the same time, or in a staggered order you control, split them up. In Illustrator use Object > Compound Path > Release. In Inkscape use Path > Break Apart. Watch the letters with holes, like o, a, e and B. After a split, the hole can become its own filled shape and cover the hole. You may need to recombine each letter's outer shape with its hole.
  3. Remove scale transforms if you can. If a group has a transform that scales it, any stroke width you set is scaled too. A 1-unit stroke can end up hairline-thin or very thick. In Illustrator, re-exporting usually flattens these. In Inkscape, set Preferences > Behavior > Transforms > Store transformation to "Optimized" and nudge the object.
  4. Give each piece a class or id so your CSS can target it, for example class "letter" on every letter path.
  5. Keep the viewBox. Don't delete the viewBox attribute on the root svg. It's what lets the logo scale.

Step 3: Pick your method

Method A: Trace the outline, then fade in the fill (easiest, works on any logo)

This is the effect you see on most "animated logo" headers. A thin line travels around the edge of each shape, then the solid color fades in. It works on any filled logo without redrawing anything.

Add this inside a style element in the SVG, or in your page CSS if the SVG is pasted inline:

.letter { fill: #1a1a1a; fill-opacity: 0; stroke: #1a1a1a; stroke-width: 1.5; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s ease-in-out forwards, fill 0.6s ease-out 1.4s forwards; } @keyframes draw { to { stroke-dashoffset: 0; } } @keyframes fill { to { fill-opacity: 1; } }

To make the values above work, add the attribute pathLength="1" to each path. That tells the browser to treat the path as 1 unit long, whatever its real size. Without it, you need each path's real length. To get that, open the page in a browser, open the developer console, select the path and run getTotalLength() on it. Then use that number (rounded up) for both the dasharray and the dashoffset.

Tips for Method A:

Method B: Mask reveal (looks like the logo is being written)

Use this method for script and handwritten logos, signatures, and any logo where you want the letters to appear along their natural writing path instead of around their edges.

How it works:

  1. Keep your filled logo exactly as it is.
  2. Draw a new path that runs down the middle of the letters, like you were writing them with a marker. Use the pen tool in Illustrator, Inkscape or Figma, and follow the stroke order a person would use.
  3. Give that new path a stroke that is thicker than the widest part of your letters, with stroke-linecap and stroke-linejoin set to round, and a white stroke color.
  4. Put it inside a mask element, give the mask an id, and apply the mask to the group that holds your filled logo (mask="url(#reveal)").
  5. Animate the mask path's dashoffset, not the logo's:

.reveal-line { fill: none; stroke: #fff; stroke-width: 40; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2s ease-in-out forwards; } @keyframes draw { to { stroke-dashoffset: 0; } }

As before, put pathLength="1" on the mask path. White areas of a mask show the logo and black or empty areas hide it, so the logo appears wherever the line has reached.

Tips for Method B:

Method C: Redraw the logo as single lines (true "pen" look)

Sometimes you want the final logo to *be* a line drawing, such as a monoline icon or a line-art mark. In that case, rebuild it as stroked paths with fill set to none, and run the standard draw-on animation. Some auto-trace tools offer a "centerline" option, but the results on letters are usually messy and need cleanup. Redrawing with the pen tool gives a cleaner result. Choose this method only if you're happy for the final logo to look like line art rather than your solid brand mark.

Quick decision checklist

Don't skip: reduced motion

Some visitors set their device to reduce motion. Respect that by adding this at the end of your CSS:

@media (prefers-reduced-motion: reduce) { .letter, .reveal-line { animation: none; stroke-dashoffset: 0; fill-opacity: 1; } }

Those visitors then see the finished logo straight away.

Final checks before you publish

  1. Open the SVG in at least two browsers, for example Chrome and Safari, and reload a few times to watch the full animation.
  2. Check that the logo looks correct after the animation ends. The forwards keyword in the animation is what keeps the final state.
  3. If the logo is added with an img tag, the CSS inside the SVG file still runs, but CSS from your main stylesheet can't reach it. Put the styles inside the SVG file, or paste the SVG inline in the page.
  4. Keep the total animation short for a header logo. Visitors see it on every page load, so a couple of seconds is usually plenty.
  5. Check the file size. Exports from design tools often carry extra metadata. Running the file through an SVG optimizer usually shrinks it, but check that the optimizer hasn't merged paths you split on purpose or removed your classes and ids.

If you'd rather not split paths and draw mask lines yourself, the link below this guide explains how to send us your SVG and get the finished, pasteable animation back.

Want the full done-for-you kit?
LoopMark Studio: Your Animated SVG Logo, Done For You (CSS Draw-On, No JavaScript, 48-Hour · $39.00
Get it on Gumroad