I noticed that some attributes use xml:
for example xml:lang="pt-BR"
? It seems to me to be an attribute, but it is not local or global. In HTML5, is it necessary to use it?
<html xml:lang="pt-BR">
</html>
I noticed that some attributes use xml:
for example xml:lang="pt-BR"
? It seems to me to be an attribute, but it is not local or global. In HTML5, is it necessary to use it?
<html xml:lang="pt-BR">
</html>
You do not need the prefix "xml" unless you want to treat your document simultaneously as an XML and HTML header. (I do not recommend this - I think it's best to just follow the HTML5 specifications)
The html tag specification suggests the use of a lang attribute, no xml prefix:
Authors are encouraged to specify a lang attribute on the root html element, giving the document's language. This aids speech synthesis tools to determine what pronunciations to use, translation tools to determine what rules to use, and so forth.
We encourage authors to specify a lang attribute in the root html element with the document language. This helps speech synthesis tools to know which pronunciation to use, translation tools to know which rules to use, etc.
A specification of the lang attribute goes deeper and says you should use the attribute without the xml:
prefix. If you want to maintain compatibility with XML / XHTML (something you normally do not need) you should use both lang
and xml:lang
.
Authors should not use the lang attribute in the XML namespace on HTML elements in HTML documents. XHTML is an XML document that can be used to create an attribute in XHTML, but it can not be used in XHTML. is also specified, and both attributes must have the same value when compared to ASCII case-insensitive manner.
Note: The attribute in the namespace with no prefix and with the literal localname "xml: lang" has no effect on language processing.
Authors should not use the lang attribute in the XML namespace in HTML elements in HTML documents. To facilitate migration to and from XHTML, authors can specify an attribute without namespace with the literal name
xml:lang
but these attributes can only be used if an attribute without the namespace is also specified, containing the same value.Note: The attribute named
xml:lang
without specifying thexml
prefix has no effect on language processing.