1
我想打一個字符,完全居中,這個圈子裏面:我如何完美地將SVG圓圈內的單個字符居中?
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100" height="100">
<g>
<circle style="fill:#eeeeee" cx="50" cy="50" r="50">
</circle>
<text>C</text>
</g>
</svg>
理想的情況下,該解決方案適用於任何單個ASCII字符。
感謝您的幫助!
謝謝!有趣的是,我必須添加'y ='2'style ='font-size:30px; fill:white''才能使文本出現,並且居中。不知道爲什麼我不得不將它撞倒兩個像素。 –