Am I required to put
xmlns="http://www.w3.org/2000/svg" Every time I use SVG?
and, what purpose does it serve?
Also, I just saw some included
version="1.1" inside the code also, is that something that’s required too, and why would someone add that to the code?
<svg viewBox="0 -3 100 106" xmlns="http://www.w3.org/2000/svg" style="background-color:000000;" width="100" height="102">
<path fill="currentColor" style="fill:orange; " d="M81 44.6c5 3 5 7.8 0 10.8L9 98.7c-5 3-9 .7-9-5V6.3c0-5.7 4-8 9-5l72 43.3z"></path>
A thorough explanation would be too much for a post or even a topic. As can be seen here
the “xmlns” is “XML Namespace” which is needed to use the correct “DTD” - “Doctype Declaration”
Kind of like the “rules” about what elements are allowed, what attributes elements can have, what child tags elements can have, what parent tags elements can have, what they must have, etc.
In other words, it’s kind of like a way of telling browsers “parse the mark-up according to these rules”
How, or even If, browsers actually parse according to the DTD varies, but having a definition to go by is a good thing.
Is there a basic rule of thumb to go by?
This one doesn’t use it,
But then this one does.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.