← All elements

Circular Text Badge

by @admin · 8 views

<div class="pc-badge" role="img" aria-label="Handmade, small batch, since 2019">
  <svg viewBox="0 0 120 120" aria-hidden="true">
    <defs>
      <path id="pc-badge-path" d="M60,60 m-44,0 a44,44 0 1,1 88,0 a44,44 0 1,1 -88,0"/>
    </defs>
    <text>
      <textPath href="#pc-badge-path" textLength="270" lengthAdjust="spacing">HANDMADE • SMALL BATCH • SINCE 2019 •</textPath>
    </text>
  </svg>
  <span class="pc-badge__core">★</span>
</div>

About this animation

Text that runs around a circle on an SVG path and spins slowly around a centre badge.

How it works

An SVG path draws a circle, and a textPath element lays the words along it. The textLength attribute spreads the letters to fill the whole circle. The SVG is rotated slowly with one keyframe, while the star in the middle sits in a separate element, so only the ring of text turns.

Ways to customise it

  • Change the words inside the textPath and adjust textLength to fit.
  • Change the 14s duration for faster spinning.
  • Change the #ffd166 centre colour or swap the star for an icon.

Good to know

Text on a path is read oddly by screen readers, so the SVG is hidden and the wrapper has an aria-label with the full phrase. Keep the phrase short, because long text will not fit on the circle.

Open an example, copy the HTML and the CSS, and paste them into your page. There is nothing to install and no JavaScript to load.

More in Css Animation

View all →