Global Attributes

HTML lang attribute

Declares the language of an element's content and relevant text attributes. It helps pronunciation, translation and language-sensitive CSS; it does not set writing direction. Applicability: global HTML attribute, subject to element-specific restrictions and browser support.

Formal Syntax & Structure

html syntaxhtml
lang="fr"

Parameters & Attributes

NameTypeDescription
langBCP 47 language tagDeclares the language of an element's content and relevant text attributes. It helps pronunciation, translation and language-sensitive CSS; it does not set writing direction.

Working Example

Example Snippethtml
<p lang="fr">Bonjour</p>

Browser Compatibility

Minimum supported versions across modern rendering engines

Widely Available
Chrome
1
Yes
Edge
12
Yes
Firefox
1
Yes
Safari
≤4
Yes
Checked desktop BCD snapshot: global lang attribute. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Language recognition is not a guarantee of assistive technology pronunciation.
HTML Living Standard
HTML Reference