Define the language of the page

Last updated:

This evaluation is included in the Accessibility audit offered by ExcellentWebCheck. Ensuring website accessibility is essential to ensure everyone can use the internet without barriers.

How to define the language of the page?

Add a lang attribute to the html element with a valid language code.

 

For english this would be:

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

Valid language codes are either two-letter or three-letter language codes. You can find the list of valid language codes in the ISO 639-1 code list.

Why is this important?

The use cases for the <html lang> attribute are:

  • Screen readers
  • Translation such as Google Translate
  • Spellchecking
  • Localized date and time input

It is crucial to define a valid lang attribute on the html tag. A screen reader uses the lang attribute to select the corresponding language to speak the text if that language is available.

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.