HTML5 <html> attributes xmlns, lang, xml:lang

后端 未结 3 2169
眼角桃花
眼角桃花 2020-12-29 21:36

I don\'t understand the HTML5 specifications for the lang and xml:lang attributes of the opening tag. Scrolling up a bit, I understand that x

3条回答
  •  灰色年华
    2020-12-29 22:33

    The lang attribute makes huge a difference on a html document when it comes to users that use a screen reader. So considering a11y you would definitely want to use it. This video is the best argument on this: https://youtu.be/0uzxu9dQnuU "Effect of lang attribute on JAWS speech". It shows how a screen reader will pronounce english text with spanish,french or german pronunciation (which is very hard to understand) just because the lang attr is set to those languages each time.

    Also check : https://www.w3.org/International/questions/qa-lang-why.en where some good reasons mentioned are:

    • Styling (for example different fonts for different languages)
    • Spelling and grammar checkers
    • Translation tools
    • Search results (page internal markup can be used to improve the quality of them based on the user's linguistic preferences)

提交回复
热议问题