Trying to figure out how to best add text to an SVG, I thought maybe it doesn’t show up because it’s black-on-black, so I gave it stroke=“white” before realizing I need to zoom out. Well, and stroke means the outline in SVG, so on the white background, it just makes the font look really thin.
This is the whole code:
<svg viewBox="0 -5 40 10" xmlns="http://www.w3.org/2000/svg"> <text stroke="white">hello</text> <circle id="myCircle" cx="5" cy="5" r="4" /> <use href="#myCircle" x="10" fill="blue" /> <use href="#myCircle" x="20" fill="white" stroke="red" /> </svg>
And most of that is just this MDN example: developer.mozilla.org/en-US/docs/Web/SVG/…/use#ex…
It does use my default font, which is Fira Sans. Will look different on other systems.
0 comments
log in to comment.