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

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

2 Likes

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.

4 Likes

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.

https://en.wikipedia.org/wiki/Document_type_declaration

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.

2 Likes