What would be the right way to store country name in SVG file? I use id to store country codes, but it would be very useful to have country names attached to the paths too.
Acoarding to this article, I should use some custom namespace for country names? Or is there some attribute which is usually used? I checked some publicly available SVG maps and could't find any keeping country names.
Each element can contain <desc> and <title> elements which are used exactly for describing the shape that is drawn. You should use one of those.
If you want a semantic description that can be seen by people/software looking inside the file, or maybe manipulate it with JavaScript to display it to the user, select, filter, or whatever, then you should use the <desc> element.
The <title> element, on the other hand, will be displayed to the user when hovering over it, just like the equivalent title attribute in HTML. Note that the title must be the first child element to behave correctly as a tooltip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With