We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

:lang Redirect 1


The :lang CSS pseudo-class matches elements based on the language the element is determined to be in. In HTML, the language is determined by a combination of the lang attribute, the <meta> element, and possibly by information from the protocol (such as HTTP headers). For other document types there may be other document methods for determining the language.

Acceptable language-code strings are specified in the HTML 4.0 specification.


element:lang(language-code) { style properties }


In this example, the lang selector is used to match on the parent of a quote element using child selectors. Its not meant to demonstrate the only way to do this, or even the correct way (which would depend on the type of document). Note, Unicode values are used to specify special quote characters.

:lang(en) > Q { quotes: '\201C' '\201D' '\2018' '\2019'; }
:lang(fr) > Q { quotes: '« ' ' »'; }
:lang(de) > Q { quotes: '»' '«' '\2039' '\203A'; }


  <div lang="fr"><q>This French quote has a <q>nested</q> quote.</q></div>
  <div lang="de"><q>This German quote has a <q>nested</q> quote.</q></div>
  <div lang="en"><q>This English quote has a <q>nested</q> quote.</q></div>

... looks like ...


Specification Status Comment
Selectors Level 4 Working Draft No change.
Selectors Level 3 Recommendation No significant change.
CSS Level 2 (Revision 1) Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) 8.0 8.0 3.1
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.0 1.0 (1) 8.0 8.0 3.1

See also

Document Tags and Contributors

Last updated by: Sheppy,