Is HTML case sensitive?
In an example I’m working with it says:
<!doctype html> or
<!DocType Html> work differently (or not at all)?
No, but it’s considered good practice to keep HTML markup lowercase.
In other words,
<!DOCTYPE html>, case-insensitively.
Many strings in the HTML syntax (e.g. the names of elements and their attributes) are case-insensitive, but only for characters in the ranges U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and U+0061 to U+007A (LATIN SMALL LETTER A to LATIN SMALL LETTER Z). For convenience, in this section this is just referred to as “case-insensitive”.
In addition to the other answers given, if you set the header
Content-type: application/xhtml+xml, your browser will throw and XHML error if you don’t type DOCTYPE in uppercase and html in lowercase:
Using the XHTML content type isn’t recommended because the page won’t be rendered in some browsers (e.g. IE8 and below), but it’s certainly interesting to know.
HTML is case insensitive.
XHTML, that is being
XML is case sensitive.
Generally, HTML is case-insensitive, but there are a few exceptions. Entity names (the things that follow ampersands) are case-senstive, but many browsers will accept many of them entirely in uppercase or entirely in lowercase; a few must be cased in particular ways. For example, Ç is Ç and ç is ç. Other combinations of upper and lower case are no good.
No, you can use any case you want.