Why is "DOCTYPE" uppercase but "html" lower?

HTML is not a case sensitive language. So why should the DOCTYPE be in capitals?


In a word, convention.

As for case sensitivity, it still applies where XML conforming documents are concerned. Guess what folks, JSX and React are XML conforming.

If neither of those is a concern, then by all means continue with the assumption that case insensitity exists. We still come back to convention. The thing that can only be attributed to unwritten rules. Write HTML in UPPERCASE at one’s own peril.

The thing to keep in mind is that the document type declararation is not HTML or XML. It is SGML, the parent schema of the whole shebang, and IT is case insensitive. After that, the other paradigms shed their own light.


Soooooo don’t write in uppercase?, which would circle back to the original issue of why doctype was in uppercase.


The DTD is not HTML, and nor is it XML. It is SGML. The case doesn’t matter.


Or does it? The easiest way to confirm this is to create a series of pages using all available DTD’s and validate each one using validator.w3.org.


SQL makes it a common practice (for readabilities sake) to capitalize statements:

SELECT * FROM Customers;

However, it is also valid in SQL not to capitalize on the above example:

select * from customers;

If you were to inspect your browser (for which I am using Chrome in case another browser shows otherwise) you would find the DOCTYPE not capitalized.

So, one could conclude it is a matter of readability and possibly previous standards that have now become less applicable due to improvements in syntax structure and computer technologies.

Nothing has changed. Recall, the DTD is not HTML.

1 Like

You are correct sir. I probably should have said it more generally because it was something I wasn’t entirely familiar with. Thank you for your reply. :slight_smile: