CSS Selector Level 4 » Lang pseudo-class

The lang pseudo-class will match the elements based on the document language. This could be set via the lang HTML attribute, an HTTP or <meta> information and it's similar to the CSS2 lang pseudo-class selector. The difference is the newly introduced wildcard selector which allows to select more languages at once.

Syntax

Copy
:lang(*-language) {
    /* declarations */
}

Example

Copy
:lang(en-*) {
    color: red;
}

While all elements with a language attribute that indicates English will have a red color, the French text will keep its default color.

Try example in CodePen

Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop No No No No No No
Mobile No No No No No No

Usage statistics (Alexa Top 500,000 sites)


Please wait a moment, the comments start loading now...
explorermozillachromesafariopera