gpt4 book ai didi

xml - xhtml 文档 - Lang 选项问题

转载 作者:数据小太阳 更新时间:2023-10-29 02:02:43 25 4
gpt4 key购买 nike

下面两行有什么区别?:

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

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

如果我没有meta标签,会有什么后果?

meta 会影响屏幕阅读器而 top 不会吗?我对他们到底做了什么感到有点困惑。

在此先感谢您的帮助

最好的问候

跳过。

最佳答案

深入了解辅助功能的 Identifying your language page建议尽可能多地添加以处理尽可能多的屏幕阅读器,具体取决于您的文档类型:

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”值是有效的。

谷歌的 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 来描述文档语言的区别,并暗示两者都是必需的。

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

总而言之,看起来屏幕阅读器更关注 lang 属性而不是内容语言元信息,但我看到的大多数建议还是建议使用元数据。尤其是 Google 统计数据似乎很相关,所以也许您应该将两者都保留。

关于xml - xhtml 文档 - Lang 选项问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/764028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com