显式还是自动关闭

显式还是自动关闭

本文介绍了关闭SVG标签,显式还是自动关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在验证我的代码,并得到以下错误

在IE浏览器中,路径 d =m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c,您只需使用 > 关闭它们。同样的事情适用于svg标签吗?像这样:

<路径 d = m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c >



或...使用明确的结束标记?像这样:

<路径 d = m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c > < / path>
$ b 关闭路径的方式?

解决方案

无论您使用的验证是否正确, b
$ b

结束。即你可以写一个路径为<路径>< / path> 或<路径/> ,但是你不能将它写成<路径>


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.

<path d="m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c" />

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:

<path 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:

<path d="m53.911,10.023c-1.46-.898-3.195-1.019-4.699-1.019h-3.439c" > </path>

What is the correct way of closing a path?

解决方案

Whatever validation you're using is working incorrectly.

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标签,显式还是自动关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:51