why google don't use DOCTYPE in its HTML? [closed]
I know DOCTYPE is important because some CSS rules need specific DOCTYPE. but why some sites like google.com don't specify DOCTYPE for their HTML?
The doctype is not necessary, it can be omitted:
http://www.w3.org/TR/html5-diff/
See chapter 2.2. The DOCTYPE:
"The HTML syntax of HTML5 requires a DOCTYPE to be specified to ensure that the browser renders the page in standards mode. The DOCTYPE has no other purpose and is therefore optional for XML. Documents with an XML media type are always handled in standards mode. [DOCTYPE]
The DOCTYPE declaration is < !DOCTYPE html> and is case-insensitive in the HTML syntax. DOCTYPEs from earlier versions of HTML were longer because the HTML language was SGML-based and therefore required a reference to a DTD. With HTML5 this is no longer the case and the DOCTYPE is only needed to enable standards mode for documents written using the HTML syntax. Browsers already do this for < !DOCTYPE html>."
Though I think it should be used to avoid confusions.
Using simply <doctype html>
is enough for browsers to switch standart compliant mode. So there's no need to waste bytes for long doctypes.
精彩评论