O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

:lang

Applies to:

Any element with associated language-encoding information.

Description:

This matches elements based on their human-language encoding. Such language information must be contained within or otherwise associated with the document; it cannot be assigned from CSS. The handling of :lang is the same as for |= attribute selectors. For example, in an HTML document, the language of an element is determined by its lang attribute. If the document does not have one, the language of an element is determined by the lang attribute of its nearest ancestor that does have one, and lacking that, by the Content-Language HTTP header response field (or the respective meta http-equiv) for the document.

Examples:

html:lang(en) {background: silver;}
*:lang(fr) {quotes: '« ' ' »';}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required