关闭 SVG 标签,显式关闭还是自关闭? [英] Closing SVG tags, explicit or self closing?
问题描述
我正在验证我的代码,并收到以下错误 标签不能自动关闭.使用显式结束标记.
在 IE 中作为我的 svg 路径,因为它是自动关闭的.
I was validating my code, and got the following error Tag cannot be self-closing. Use an explicit closing tag.
in IE for my svg path because it's self closing.
d="m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c"
/>
现在我知道 HTML5 中的元标记不需要向前破折号 /
,你只需用 >
关闭它们.同样的事情是否适用于 svg 标签?像这样:
Now I know meta tags in HTML5 don't require the forward dash /
, you just close them with >
. Does the same thing apply to svg tags? Like so:
d="m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c"
>
或者……使用明确的结束标签?像这样:
Or… Using an explicit closing tag? Like so:
d="m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c"
>
关闭路径的正确方法是什么?
推荐答案
无论您使用的是什么验证都无法正常工作.
Whatever validation you're using is working incorrectly.
SVG 和 MathML 标签如果以/> 结尾则在 HTML 中自闭合一>.IE.您可以将路径写为
或
但不能将其写为
SVG and MathML tags are self closing within HTML if they end with />. I.e. You can write a path as <path></path>
or <path/>
but you can't write it as <path>
这篇关于关闭 SVG 标签,显式关闭还是自关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!