:lang CSS Pseudo Class
:lang pseudo-class in CSS is used to select elements based on the language specified in the HTML
lang attribute. It allows you to apply styles to elements based on the language of the document, enabling web developers to create multilingual websites with different styles for different languages.
Here's an example of how you might use the
:lang pseudo-class in CSS:
/* Styles for English text */
font-family: Arial, sans-serif;
/* Styles for French text */
font-family: "Trebuchet MS", sans-serif;
In this example, the
:lang(en)selector targets elements with the
langattribute set to "en" (English) and applies specific styles to them, such as setting the font family to Arial and the text color to a dark shade of gray. Similarly, the
:lang(fr)selector targets elements with the
langattribute set to "fr" (French) and applies different styles, like using the "Trebuchet MS" font family and a slightly lighter gray text color.
By utilizing the
:langpseudo-class, developers can enhance the user experience by adjusting the visual presentation of content based on the language in which it is written.
:lang(<language-code> [,<language-code> ]*) /* ... */ }
- <language>represents the language you want to target, such as: en - English; ru - Russian; de - German fr - French; it - Italian etc
Music during road trips and long commutes aren’t a problem, but using headphones isn’t the best thing to do while
driving in your car.
Gdy widzimy znak z narysowaną czaszką i napisem <strong lang="en-US">DANGER</strong> to lepiej nie wchodzić do środka.
outline: 2px solid deeppink;
The following table will show you the current browser support for the CSS
:lang pseudo class.
|Tablets / Mobile|
Last updated by CSSPortal on: 1st October 2023