CSS :lang() Pseudo-Class

Definition and Usage

CSS :lang() Pseudo-classes are used to select elements that have a specified lang elements with the attribute value.

Note:lang The attribute value is usually a two-letter language code, such as lang="fr" (representing French), or a combination of two language codes, such as lang="fr-ca" (representing Canadian French).

Example

Set styles for any <p> element with a lang attribute value of "it" (Italian):

p:lang(it) {
  background-color: yellow;
  font-style: italic;
}

Try It Yourself

CSS Syntax

:lang(languagecode) {
  css declarations;
}

Technical Details

Version: CSS2

Browser Support

The numbers in the table specify the first browser version to fully support the pseudo-class.

Chrome Edge Firefox Safari Opera
4.0 8.0 2.0 3.1 9.6