Identify the language of the page or content
Identifying the language of the page, or inline content as needed, is important for assistive technology so they can present content with the right pronunciation and spelling. It can also help browsers present the content in line with the user's settings.
- Apply a lang attribute to the <html> element on all pages.
- If part of a paragraph or other inline text switches into another language, indicate that in the element.
- The language code needs to be valid. See the W3 School listing of possible lang values.
Note: do not apply a
lang attribute to the following tags:
Global lang on <html> element
By default, a
lang="" attribute should be applied to all pages.
Inline lang in text
Part of a paragraph is in French, so a
<span> with a French lang attribute of is applied to that part.
<p>It has a certain <span lang="fr">je ne sais quois.</span></p>