您好,欢迎访问一九零五行业门户网

w3c是怎样规定<meta>标签的 到底有没有结束的斜杠?

哪种是更规范的写法回复内容:泻药
去查规范
html 4
the global structure of an html document
start tag: required, end tag: forbidden
html5
4.2 document metadata
tag omission in text/html: no end tag.
所以:
第一种写法更贴近规范这里有一个来自 stackoverflow 的回答,它比较详细地解释了你这个问题:
html - are self-closing tags valid in html5?
in html 5, means , the start tag. it is not a self-closing tag. instead, certain elements are designated as having no end tag, for example
. these are collectively called void elements. the slash is just syntactic sugar for people who are addicted to xml. using the slash in a non-void element tag is invalid, but browsers parse it as the start tag anyway, leading to a mismatch in end tags.自闭合标签使用html5的doctype时不用写反斜杠。
其它类似信息

推荐信息