As best as I can tell, the only meta tag difference between HTML4 and HTML5 is the new “charset” attribute, which is just a shorthand for http-equiv=“Content-Type” content=“text/html; charset=UTF8”.
Though, I’d suggest you move the charset meta above the title, otherwise the title won’t be able to use the full range of characters.
global attributes: HTML4 allows lang and dir, HTML5 allows global attributes on all HTML elements.
http-equiv: HTML4 says this attribute is for servers, HTML5 says it’s for UAs. HTML4 allows any HTTP header, HTML5 has a small set of allowed values.
name: HTML4 “does not list legal values for this attribute.”, HTML5 lists legal values and has a wiki page as extension point.
scheme: obsolete in HTML5.
New element-specific attributes in HTML5: charset.
Global attributes in HTML5 other than link and dir:
accesskey
class
contenteditable
contextmenu
draggable
dropzone
hidden
id
inert
itemid
itemprop
itemref
itemscope
itemtype
spellcheck
style
tabindex
title
translate
event handler attributes
data-* attributes
ARIA attributes
content model: HTML4 allows only in head, HTML5 allows in body when microdata attributes are used, and in noscript in head (depending on the attributes).
required attributes: HTML4 has all attributes except content optional, and content required. HTML5 says “Exactly one of the name, http-equiv, charset, and itemprop attributes must be specified. If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified. Otherwise, it must be omitted.”
Well that’s just scratching the surface, if you check the definition of each name and http-equiv keyword in HTML4 and HTML5 you’ll likely find that every one of them is changed in some way (probably because HTML4 is so handwavy).
Why not? Doesn’t the browser need to know the encoding before it can decode the title? Yes, it does, but the charset meta is scanned for in the first 1024 bytes before the real HTML parser starts. (The HTML parser also looks for charset metas if the scanner failed to find one, but this can cause the page to be renavigated and scripts to execute twice so it’s a bad idea to rely on it and it’s invalid).
I’d say it’s a good idea to declare the encoding in the HTTP header so the scanner can be skipped altogether.
I didn’t mean a ‘requirement’, it never has been to my knowledge? I agree it’s a lot lower down the food chain order than HTTP Content-Type header; etc; if available.
By default, you can only use ASCII characters unless you have declared a different character set. That takes effect from the point where you make the declaration. So anything you have before the <meta charset> must be in ASCII or use HTML entities for any non-ASCII characters.