I am trying to center text in a SVG circle. Looked att previous solutions, however can't make it work.
How can I get the following example center the 'X' i the circle not modifying the x/y coordinates or font size?
The red cross indicating the middle.
<svg width="200px" height="200px">
<circle r="50" cx="100" cy="100"></circle>
<text x="100" y="100" fill="white"
font-size="100" text-anchor="middle" dominant-baseline="middle"
font-family="Verdana">X</text>
<line x1="50" y1="100" x2="150" y2="100" stroke="red" stroke-width="2"></line>
<line x1="100" y1="50" x2="100" y2="150" stroke="red" stroke-width="2"></line>
</svg>
You can adjust the dy attribute of the
<text> element to move the text slightly upward. Then dy attribute controls the vertical offset of the text relative to the y-coordinate. look at the example: