Circular text made with CSS trigonometric functions

Circular Text with CSS

Jhey Tompkins
7 min readFeb 18, 2023

Have you ever wanted to lay out some text in a circle but it felt like a lot of prodding in the dark? How might you do it today? Could you do it with CSS alone in an accurate way? Let’s take a look at a new way 👀

How you might solve this today

You’ve definitely got options. Before we go down the CSS route, you could use images. The least maintainable route could be creating an image each time you need to change the text. Make sure to use the `alt` attribute to describe the text that’s shown.

Circular text generated in Figma

The SVG generated in Figma, creates a path for each letter individually based on their position.

Or you could use an inline SVG. SVG has a textPath element. For the most part, it’s pretty good. You give it some text and a path to lay that text on.

viewBox="0 0 100 100"
M 10, 50
a 40,40 0 1,1 80,0
40,40 0 1,1 -80,0
<textPath href="#circlePath">
Your text here!

This route does pose a couple of hurdles. First, you need a path. You can’t pass a…