问题描述
我想知道xml:lang属性做了什么以及它在HTML5中的值是什么。并且xml:lang属性是否有任何限制?
I was wondering what does the xml:lang attribute do and what are it's values in HTML5. and does the xml:lang attribute have any restrictions?
推荐答案
正如标准草案中的解释,它是标准 lang 属性,指定文档的自然语言。它可以采用定义的任何值。但请注意,如果您拥有XML文档或者还要定义 lang
,则只能使用 xml:lang
属性。属性,在后一种情况下,它们必须具有相同的值。这是因为 xml:lang
仅允许轻松转换旧的XHTML文档:
As the standards draft explains in 3.2.3.3 The lang
and xml:lang
attributes, it is the XML variant of the standard lang
attribute, specifying the natural language of the document. It can take any value defined by BCP47. Note however that you may only use the xml:lang
attribute if you either have an XML document or also define the lang
attribute, and in the latter case they must have the same value. This is because xml:lang
is allowed only to ease transition of old XHTML documents:
这篇关于有人能解释一下xml:lang属性在HTML5中的作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!