当前位置 : 主页 > 网页制作 > xml >

xml – xhtml文档 – Lang选项问题

来源:互联网 收集:自由互联 发布时间:2021-06-13
下面显示的2行之间有什么区别?: html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB"meta http-equiv="content-language" content="en-GB" / 如果我没有元标记,会有什么后果? meta元素会影响屏幕阅读器而
下面显示的2行之间有什么区别?:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">

<meta http-equiv="content-language" content="en-GB" />

如果我没有元标记,会有什么后果?

meta元素会影响屏幕阅读器而不是顶级屏幕阅读器吗?我对他们到底做了什么感到有点困惑.

在此先感谢您的帮助

最好的祝福

跳跃.

Dive Into Accessibility的 Identifying your language page建议尽可能多地添加处理尽可能多的屏幕阅读器,具体取决于您的doctype:

If you’re using any variant of HTML 4,
change your tag to this (use
your own language code if not
English):

<html lang="en">

If you’re using any variant of XHTML
1.0, change your tag to this (use your language code in both
places):

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

If you’re using XHTML 1.1, change your
tag to this (again, insert your
own language code):

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

同一篇文章也引用了ISO 639.2来确定xml:lang的值应该是什么,尽管XML规范引用了一个单独的文档RFC4646 Best Current Practice – Tags For Identifying Languages,它似乎表明你的“en-GB”的值是有效的.

Google的Web Authoring Statistics(2005)有以下内容可以说:

Next is the Content-Language value
(used on the http-equiv attribute).
Almost as many people use this as
specify the lang attribute on the html
element. In the HTML5 spec currently
the http-equiv attribute is only
allowed for the one case of setting
the character encoding, which can’t
really be dropped, as the graph above
demonstrates. However,
http-equiv=”Content-Language” is
supported by at least one browser, and
as we see here, it is widely used —
maybe http-equiv should not be removed
after all.

此外,thread on webproworld讨论了使用http-equiv = content-language和name = language来描述文档的语言之间的区别,并暗示两者都是必要的.

最后,请参阅W3C的HTML Techniques for Web Content Accessibility Guidelines 1.0文档以获取更多建议,特别是Identifying the Primary Language.

总而言之,屏幕阅读器看起来比内容语言元信息更多地关注lang属性,但我见过的大多数建议都建议使用元数据.特别是谷歌的统计数据似乎是相关的,所以也许你应该留下两个.

网友评论