HTML langAttribute

HTML 全局属性HTML Global Attributes

Example

A paragraph containing some French:

<p lang="fr">This is a paragraph.</p>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the lang attribute


Definition and Usage

The lang attribute specifies the language of the element's content.


Differences between HTML 4.01 and HTML5

In HTML5, the lang attribute can be used on any HTML element (it will validate any HTML element, but not necessarily be useful).

In HTML 4.01, the lang attribute cannot be used on: <base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param>, and <script>.


Syntax

<element lang="language_code">

Attribute Values

Value Description
language_code Specifies the language code for the element's content. Language code reference manual.Language Code Reference Manual


HTML 全局属性HTML Global Attributes Other Extensions