I need to do a circular menu, with an unknown/variable number of elements (I underline this point because not interested in 3 or 4 elements static solutions).
I decided to use SVG. As I build the HTML/SVG with the server side code, having a SVG path, I can put the text on that path with startOffset = "@(100/items.Count)%"
.container { width: 300px; }
svg { border: 1px solid; }
a:hover { fill: red; }
<div class="container">
<svg viewBox="0 0 200 200">
<defs>
<desc>The path used for the text</desc>
<path id="c" d="M150,100 A50,50 0 1 1 150,99.99z" />
</defs>
<use xlink:href="#c" stroke="#d9d9d9" fill="none"/>
<text font-size="20" >
<textPath xlink:href="#c" startOffset="33%">
<a xlink:href="https://stackoverflow.com">Our products</a>
</textPath>
</text>
<text font-size="20" text-anchor="middle">
<textPath xlink:href="#c" startOffset="66%">
<a xlink:href="https://stackoverflow.com">Services</a>
</textPath>
</text>
<text font-size="20" text-anchor="end">
<textPath xlink:href="#c" startOffset="99%">
<a xlink:href="https://stackoverflow.com">Achievements</a>
</textPath>
</text>
</svg>
</div>
My question is how to make the text readable for the user (not be superposed, inverted, hard to read) ? The concrete question would be how to make the text horizontal, keeping its position/"base point" on the circle's path? After that I will use something like
.textbox {
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
PS. I am interested more in SVG/CSS/HTML simple solutions rather that JS complex drawing libraries.