pseudo-class

:lang() — CSS reference

Matches the content language, including inherited language and matching subtags. It is not equivalent to a direct lang attribute test.

Formal Syntax & Structure

css syntaxcss
:lang(language-range)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }p:lang(fa) { color: rgb(0, 96, 80); }</style></head><body><div lang="fa-IR"><p id="a" class="sample">سلام</p></div><p id="b" class="sample" lang="en">B</p></body></html>
CSS Reference