<html> element has a [lang] attribute

The page declares its language so screen readers use the correct voice.

On this page

Impact

ScanGov impact ratings

About

If a page doesn't specify a lang attribute, a screen reader assumes that the page is in the default language that the user chose when setting up the screen reader. If the page isn't actually in the default language, then the screen reader might not announce the page's text correctly.

Risks

Screen readers mispronounce content, confusing users.

Why it's important

Helps screen readers pronounce content correctly by identifying the language of the page and its elements.

User stories

As a screen reader user, I want the page language to be correctly identified so that content is pronounced properly.

Code

Failing pattern:

<!-- Fail: no lang attribute -->
<html>

Passing pattern:

<!-- Pass: lang attribute present -->
<html lang="en">

Error

ScanGov messaging when a site fails a standard:

Failed: <html> element has a [lang] attribute

Guidance

Indicators

On this page