有人能解释一下xml:lang属性在HTML5中的作用吗? [英] Can someone explain what the xml:lang attribute does in HTML5?

查看:398
本文介绍了有人能解释一下xml:lang属性在HTML5中的作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道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?

推荐答案

正如标准草案中的解释 3.2.3.3 lang xml:lang 属性,它是标准 lang 属性,指定文档的自然语言。它可以采用 BCP47 定义的任何值。但请注意,如果您拥有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:


作者不得在HTML文档中的HTML元素中使用lang属性。为了简化与XHTML之间的迁移,作者可以在没有前缀的名称空间中指定一个属性,并在HTML文档中的HTML元素上指定文字本地名xml:lang,但只有在没有名称空间的lang属性时才能指定这些属性也指定了,并且在以ASCII不区分大小写的方式比较时,两个属性必须具有相同的值。

Authors must not use the lang attribute in the XML namespace on HTML elements in HTML documents. To ease migration to and from XHTML, authors may specify an attribute in no namespace with no prefix and with the literal localname "xml:lang" on HTML elements in HTML documents, but such attributes must only be specified if a lang attribute in no namespace is also specified, and both attributes must have the same value when compared in an ASCII case-insensitive manner.

这篇关于有人能解释一下xml:lang属性在HTML5中的作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆