What happens if instead of typing at the beginning of my HTML I type with the characters html being capital? Or if I type <!doctype HTML> or any variation of capital or lower case characters?
This is a weird question. I’m not saying stupid, but weird.
I have, honestly, no idea – as I’ve always respected the standards set.
<!DOCTYPE html> declaration is used to inform a website visitor’s browser that the document being rendered is an HTML document. While not actually an HTML element itself, every HTML document should begin with a DOCTYPE declaration to be compliant with HTML standards.
You can also just use
<html>, but to be HTML5 compliant, just use the
<!DOCTYPE html> declaration.
Ok. Thank you very much!
The document type declaration is not HTML, so it doesn’t matter how we write it…
<!DOCTYPE HTML> <!DOCTYPE html> <!doctype HTML> <!doctype html>
All above are valid.
As for the HTML, itself, that would depend upon whether it is meant to be XML compliant or not. HTML as text/html is actually HTML 4, for the most part, so what is valid in HTML 4 is valid in HTML5. HTML as application/xhtml+xml must follow the syntax rules of XHTML, meaning lowercase only.
The following checks as valid HTML5
<!DOCTYPE HTML> <HTML LANG=EN> <HEAD> <TITLE>TEST FOR CASE VALIDITY</TITLE> </HEAD> <BODY> <DIV> <H1>TEST FOR CASE VALIDITY</H1> </DIV> </BODY> </HTML>
As mentioned above, there is a conventional approach used by today’s developer community that comes from the XHTML school of thought… Use lowercase only on all markup and quote all attributes as a best practice. Standards apply to structure and accessibility more so than best practice does, but the two together are good to know and follow.