OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

SVG letters can not evenly spaced

  • Thread starter Thread starter Franva
  • Start date Start date
F

Franva

Guest
I position each letter with 0, 12, 24, 36 etc... on x axis. I am expecting each letter will be spaced evenly, but they are not.

Code:
const websiteName = "websitename".split('');

<svg width="180" height="36" style={{display:"block"}}>
    {                  
       [...websiteName].map((letter, i) => (
           <text x={i*12} y="30" fontSize="22" key={i}>{letter}</text>
       ))
                    }
</svg>

Here is how it look like:

enter image description here

What is the cause and how to fix it?

<p>I position each letter with 0, 12, 24, 36 etc... on x axis. I am expecting each letter will be spaced evenly, but they are not.</p>
<pre><code>const websiteName = "websitename".split('');

<svg width="180" height="36" style={{display:"block"}}>
{
[...websiteName].map((letter, i) => (
<text x={i*12} y="30" fontSize="22" key={i}>{letter}</text>
))
}
</svg>
</code></pre>
<p>Here is how it look like:</p>
<p><a href="https://i.sstatic.net/Ws2px.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ws2px.png" alt="enter image description here" /></a></p>
<p>What is the cause and how to fix it?</p>
 

Latest posts

M
Replies
0
Views
1
Mohit Pant
M
Top