accessibility-guidelines

This document is in beta. Help us by reporting issues via Github or email.

Back to the overview page

Language of page

In code, identify the human language that the page content is written in.


On this page:


Requirements

Why?

Official wording in the Web Content Accessibility Guidelines

3.1.1 Language of Page: The default human language of each Web page can be programmatically determined. (Level A)

See the W3C’s detailed explanation of this guideline with techniques and examples.


Guidance for Web

Note: It’s better to only use the two-letter code representing the language (like lang="en"), rather than including the country as well (like lang="en-gb" or lang="en-us"):

Example

<html lang="en">
  <!--  -->
</html>

Failure example

<html>
  <!--  -->
</html>

Common mistakes

More guidance for Web


More info

Sources

Contribute

This document is in beta. Help us by reporting issues via Github or email.