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 1,250,000 sites)
Due to an extreme price increase of our statistics provider the data collection was stopped in September 2018.
Please wait a moment, the comments start loading now...