CSS :lang() Selector

❮ Previous Selectors Next ❯

Example

/* English */
:lang(en) {
  color: red;
}

/* French */
:lang(fr) {
  color: green;
}

/* Hindi */
:lang(hi) {
  color: pink;
}

Meaning

The :lang() selector selects elements based on the language they are determined to be in.

Note: In HTML, the language is determined by a combination of the lang attribute, the <meta> element, and possibly by information from the protocol (such as HTTP headers). For other document types there may be other document methods for determining the language.

Version: CSS2




Standard Syntax

:lang(language-code) {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Parameter

Value Description
language-code Specifies a string representing the language you want to target.
❮ Previous Selectors Next ❯