为什么一些html开始标记以正斜杠结束? [英] Why does some html beginning-tags end with a forward-slash?
问题描述
这可能是一个菜鸟问题,但我需要知道我需要知道什么:)
为什么一些html开始标记以正斜杠结尾?
例如:
< meta name =keywordscontent =bla bla bla/>
最后的正斜杠是什么?
另外一些其他标签也有这个功能...我删除了一些没有任何发生的东西。
<在 XHTML中
< foo />
是<$ c的简写如果您正在编写XHTML,但假装它是HTML (因此不支持XHTML的浏览器(如Internet Explorer 8)可以处理它),那么定义为 EMPTY
必须以这种方式表示(并且不是必须的元素)。
This is probably a rookie question, but I need to know what I need to know :)
Why does some html beginning-tags end with a forward-slash ? For example this:
<meta name="keywords" content="bla bla bla" />
Whats that last forward slash for? What happens if I remove it?
Also some other tags have this as well... I have removed some without anything happening.
In XHTML <foo />
is shorthand for <foo></foo>
. In HTML the syntax is obscure and marked as "don't do this" as browsers don't support it.
If you are writing XHTML but pretending it is HTML (so that browsers (such as Internet Explorer 8) which don't support XHTML can handle it), then elements defined as EMPTY
in the specification must be represented that way (and elements which are not must not).
这篇关于为什么一些html开始标记以正斜杠结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!