Uppercase or lowercase doctype?
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.
Why !DOCTYPE and not !doctype ?
It's just a convention that we do uppercase. The spec says that it's case-insensitive.
In other words,
<!DOCTYPE html>
, case-insensitively.
Why !DOCTYPE and not !doctype ?
It's just a convention that we do uppercase. The spec says that it's case-insensitive.
In other words,
<!DOCTYPE html>
, case-insensitively.
What is the meaning of public= storage in the HTML doctype?
Someone else posted this in an answer but deleted it for some reason. It is apparently a joke by the author of that document — who, in a comment on a GitHub issue, links to a number of other instances of this oddity within the same project. As Quentin comments,
I suspect this falls under the category of "None of the tools we use care about what comes after the 'html' bit of the Doctype, let's just shove our extendo-crap in there"
What you see is not valid DOCTYPE syntax. The formal public identifier follows the PUBLIC
keyword separated by optional whitespace, not an equals sign. The other examples linked to by the author of the document don't seem to have an equals sign like this one does, but as mentioned it doesn't make any difference anyways.
As for case sensitivity, DOCTYPE declarations are only case-sensitive in XML.
Is HTML case sensitive?
No, but it's considered good practice to keep HTML markup lowercase.
What are HTTP 'method' capitalization best practices?
The HTML5 spec requires to use "get" or "post".
Questions about Doctype
This is probably because you are using elements that are associated with a specific DOCTYPE. <!DOCTYPE html>
defaults to html5. If no DOCTYPE is specified, you webpage defaults to quirks mode. Since you set everything up according to this standard, it isn't compatible with a standard mode.
Related Topics
Divs VS. Tables a Rebuttal Please
How to Make a Line Before and After My H1 Tag
Css3 Scale - Prevent from Scalling Text
How to Change the Color of <Div> Element Depending on Its Height or Width
Base64 Encoded Image Is Not Showing in Gmail
CSS Custom Cursor Doesn't Work in Ff/Chrome
HTML Video Player Plays Sound But Not Video
How to Convert Screen Coordinates to Document Space in a Scaled Svg
Pure CSS Chessboard with Div & No Classes or Ids, Is It Possible
How to Make Rooftext Effect and Valley Text Effect in HTML5 (Or Fabric.Js)
Which Elements Support the ::Before and ::After Pseudo-Elements
Remove Blur Effect on Child Element
Why Is an Element with Position: Fixed Moving with a Non-Positioned Sibling
Padding Is Not Working in Safari and Ie in Select List
Fallback for CSS Attributes Without Unit
Export HTML Table to Excel Using ASP.NET
How to Get a List of All Countries/Cities to Populate a Listbox