Are My Meta Tags Up-to-date with HTML5 standards?

Searched around, and have been reading different answers about this topic, so I figured I would post it here and see what you guys think…

Here’s the current Meta Tags I use for Html5…

<head>
<title></title>
<meta charset=“utf-8”>
<meta name=“description” content=“”>
<meta name=“robots” content=“all”>
</head>

Am I missing anything? If you guys could post the code you use on this topic, that would be great! Thanks!

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.

There are more differences.

Not correct. It needs to be within the first 1024 bytes, though.

If you’re going to have it empty, you can omit the whole thing.

This can also be omitted.

[quote=“zcorpan,post:3,topic:18407”]

Not correct. It needs to be within the first 1024 bytes, though.[/QUOTE]

Hmm… I really thought I had seen a situation where this was the case, but now I can’t reproduce it. So it seems you’re correct. My mistake.

I guess I’m behind the curve then. What other meta tag differences are there in HTML5?

Though really it still should come before the TITLE if you are using that element for such propose that’s probably where the other confusion occurred.

Well let’s see.

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).

There’s no such requirement in the spec.

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. :slight_smile:

Ah, OK. It was a requirement early on in HTML5 actually, before the parser and pre-scanner was fully fleshed out.

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.

What is the reason for having the <meta> tags before the <title> what does it give me? I do it in my documents but i am not clear as to why.

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.

okey it’s thing so text can be display properly in the english alphabet. Here is a good example. How about the other character set’s out on the net?

It’s not really clear what your question is. You can use UTF-8 to cover most (if not all) languages.