lang – language (attribute)
<html lang="en"> … <span lang="fr">…</span>
The language of the content of an element and its descendants. On html it applies to the whole page, on a smaller element to a word, a quotation or a paragraph in another language. According to the language, screen readers choose the pronunciation and the browser the dictionary for spell checking, the hyphenation rules, the quotation marks and, for Chinese and Japanese, also the font.
Values
- A BCP 47 language tag:
en(English),fr,de,es, optionally with a region (en-GB,de-AT) or a script (sr-Latn). lang=""– the language is unknown.
- Applies to: all elements
- In JavaScript:
element.lang
Examples
A French title in English text and a style by language:
<p>The book <cite lang="fr">Le Larousse du pain</cite> has also been published in English.</p>
:lang(fr) {
font-style: italic;
}
Accessibility
Without the right lang, a screen reader reads French text with English pronunciation or vice versa. The language is therefore set for the whole page and for every longer passage in another language; not for single borrowed words (café, kindergarten).
Things to watch out for
- British English is
en-GB, noten-UK– the country code of the United Kingdom is GB. :lang(en)also selects elements withlang="en-GB"and elements that inherited the language – unlike[lang="en"].- Hyphenation with
hyphens: autoworks only for text in a known language for which the browser has a dictionary.
Browser support
Baseline – widely available: works in all major browsers and has for a long time (since 2015 at the latest). Since version: Chrome 1, Firefox 1, Safari 4. As of October 2026 (MDN browser-compat-data).
Related:
html – document root
dir – text direction (attribute)
translate – page translation (attribute)
q – inline quotation
i – text in an alternate voice