- Success Criterion 3.1.1
- Conformance level A
Language Attribute Set on the Body Instead of the HTML Root
3.1.1 — Language of Page
Scenario
Setting
A university's online course catalog
What’s wrong
lang on <body> instead of <html> in contexts where assistive technology reads the root.
Example
<html>
<body lang="en">
<h1>Course Catalog</h1>
<p>Browse 400+ undergraduate and graduate courses.</p>
</body>
</html> Why it matters
Many assistive technologies read the lang value from the html root only, so a student browsing the catalog gets no language cue at all even though someone tried to set it.
How to test
Check DevTools: if lang is set on body instead of html, some assistive technology reading the root element won't pick it up correctly.
How to fix
The lang attribute belongs on html; setting it on body alone is not equivalent and some assistive tech ignores it there.
<html lang="en">
<body>
<h1>Course Catalog</h1>
<p>Browse 400+ undergraduate and graduate courses.</p>
</body>
</html> Outcome
A prospective student hears course titles pronounced correctly while comparing programs.
Who is affected
Screen reader users relying on correct pronunciation of course names and department abbreviations get none, because the attribute sits in the wrong place.
Learn more
- Understanding Understanding document (opens in a new tab)
Related scenarios
- Page Published With No Language Declared in the Code
- HTML Element Missing Its Language Attribute Entirely
- Page’s Declared Language Not Matching Its Actual Content
- Language Attribute Set to an Invalid or Malformed Value
- Language Switcher That Doesn’t Update the Page’s Lang Attribute
- Multilingual Site Serving Every Locale With the Same Lang Value