大写或小写文档类型? [英] Uppercase or lowercase doctype?
问题描述
<!DOCTYPE html>在编写HTML5 doctype时,什么是正确的方法?
或
<!doctype html>
在HTML中,DOCTYPE不区分大小写。以下DOCTYPE都是有效的:
<!doctype html>
<!DOCTYPE html>
<!DOCTYPE HTML>
<!DoCtYpE hTmL>
在XML序列化(即XHTML)中,DOCTYPE不是必需的,但如果使用它, DOCTYPE
应该是大写:
<!DOCTYPE html>
请参阅 HTML5的XML序列化,又名'XHTML5' :
请注意,如果在XHTML文档中不包含大写
DOCTYPE
,则XML解析器将返回语法错误。
<第二部分可以用小写(html
),大写(HTML
)或者混合大小写(hTmL
) - 它仍然有效。但是,要符合适用于HTML的XHTML文档的Polyglot标记准则,应该写入小写。
When writing the HTML5 doctype what is the correct method?
<!DOCTYPE html>
or
<!doctype html>
In HTML, the DOCTYPE is case insensitive. The following DOCTYPEs are all valid:
<!doctype html>
<!DOCTYPE html>
<!DOCTYPE HTML>
<!DoCtYpE hTmL>
In XML serializations (i.e. XHTML) the DOCTYPE is not required, but if you use it, DOCTYPE
should be uppercase:
<!DOCTYPE html>
See The XML serialization of HTML5, aka ‘XHTML5’:
Note that if you don’t uppercase
DOCTYPE
in an XHTML document, the XML parser will return a syntax error.The second part can be written in lowercase (
html
), uppercase (HTML
) or even mixed case (hTmL
) — it will still work. However, to conform to the Polyglot Markup Guidelines for HTML-Compatible XHTML Documents, it should be written in lowercase.
这篇关于大写或小写文档类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!