Summarized test results:
CSS3 Selectors, language selectors

Intended audience: users, XHTML/HTML coders (using editors or scripting), script developers (PHP, JSP, etc.), CSS coders, Web project managers, and anyone who wants to know how language selectors work in current browsers.

Updated

These tests check whether various methods of selecting language in CSS selectors work for styling text in HTML. The lang attribute is part of the HTML vocabulary, and the xml:lang attribute is an XML attribute.

Note that the snapshot summaries of these test results are for released versions of the browsers tested. Versions that are still in development may provide better support for these features. The tests themselves do not test any vendor prefixes.

results

The tables show results for tests run on the date shown. Above the tables are summaries of the results at that date. The table data may be more up-to-date than the summary. If the tables contain some incorrectly scored tests, or tests that relate to non-released versions of browsers, these are not included in the summary.

To see the test, click on the link in the left-most column. To see detailed results for a single test, click on the link in the right-most column.

:lang

Snapshot summary, 2013-07-11
Firefox 22.0, Opera 12.16, Internet Explorer 10 & 9, Chrome 27.0.1453.116, Safari 5.1.9

All browsers support :lang as expected.

No browser matched a language set using the xml:lang (rather than lang) attribute.

Assertion Firefox Chrome Safari Opera IE Detailed results
:lang(es), lang="es" A :lang value that matches an identical lang attribute value on the same element will produce styling.
:lang(es), lang="es" on parent A :lang value that matches an identical lang attribute value on a parent element will produce styling.
:lang(es), lang="ES" A :lang value will match a lang attribute value regardless of case differences.
:lang(es), lang="es-MX" A :lang value will match a lang attribute value when the latter contains additional subtags.
:lang(es-MX), lang="es" A :lang value will NOT match a lang attribute value when the former contains more subtags.
:lang(es), lang="mx-es" When the :lang value uses a single subtag, it will NOT match against an attribute value where it appears in a different position.
:lang(en-GB), lang="en-GB" A :lang value with language and region subtags will match a lang attribute value with the same subtags.
:lang(en-GB), lang="en-GB-scouse" A :lang value with a multiple subtags will match a lang attribute value with multiple subtags as long as the first part is the same.
:lang(en-GB), lang="en-US" A :lang value and a lang attribute value will NOT match if their region subtags differ.
:lang(az-Arab-IR), lang="az-Arab-IR" A :lang value with language, script and region subtags will match a lang attribute value with the same language, script and region subtags.
:lang(az-Arab-IR), lang="az-IR" A :lang value with language, script and region subtags will NOT match a lang attribute value with the script subtag missing.
:lang(cs-CZ), lang="cs-Latn-CZ" A :lang value with language and region subtags will NOT match a lang attribute value with language, script and region subtags.
:lang(az-Arab-IR), lang="az-arab-IR" A :lang value will match a lang attribute value regardless of case differences in the script tag.
:lang(es), xml:lang="es" (html) [Exploratory] A :lang value that matches an identical xml:lang attribute value will NOT produce styling in pages served as HTML.

lang |=

Snapshot summary, 2013-07-11
Firefox 22.0, Opera 12.16, Internet Explorer 10 & 9, Chrome 27.0.1453.116, Safari 5.1.9

All browsers support lang|= selectors as expected.

No browser matched a language set using the xml:lang (rather than lang) attribute.

Assertion Firefox Chrome Safari Opera IE Detailed results
[lang|="es"], lang="es" A lang|= value that matches an identical lang attribute value on the same element will produce styling.
[lang|="es"], lang="es" on parent A lang|= value that matches an identical lang attribute value on the parent element will NOT produce styling.
[lang|="es"], lang="ES" A lang|= value will match a lang attribute value regardless of case differences.
[lang|="es"], lang="es-MX" A lang|= value will match a lang attribute value when the latter contains additional subtags.
[lang|="es-MX"], lang="es" A lang|= value will NOT match a lang attribute value when the former contains more subtags.
[lang|="es"], lang="mx-es" When the lang|= value uses a single subtag, it will NOT match against an attribute value where it appears in a different position.
[lang|="en-GB"], lang="en-GB" A lang|= value with language and region subtags will match a lang attribute value with the same subtags.
[lang|="en-GB"], lang="en-GB-scouse" A lang|= value with a multiple subtags will match a lang attribute value with multiple subtags as long as the first part is the same.
[lang|="en-GB"], lang="en-US" A lang|= value and a lang attribute value will NOT match if their region subtags differ.
[lang|="az-Arab-IR"], lang="az-Arab-IR" A lang|= value with language, script and region subtags will match a lang attribute value with the same language, script and region subtags.
[lang|="az-Arab-IR"], lang="az-IR" A lang|= value with language, script and region subtags will NOT match a lang attribute value with the script subtag missing.
[lang|="cs-CZ"], lang="cs-Latn-CZ" A lang|= value with language and region subtags will NOT match a lang attribute value with language, script and region subtags.
[lang|="az-Arab-IR"], lang="az-arab-IR" A lang|= value will match a lang attribute value regardless of case differences in the script tag.
[lang|="es"], xml:lang="es" (html) [Exploratory] A [lang|='es'] value that matches an identical xml:lang attribute value will NOT produce styling in pages served as HTML.

lang =

Snapshot summary, 2013-07-11
Firefox 22.0, Opera 12.16, Internet Explorer 10 & 9, Chrome 27.0.1453.116, Safari 5.1.9

All browsers support lang= selectors as expected.

No browser matched a language set using the xml:lang (rather than lang) attribute.

Assertion Firefox Chrome Safari Opera IE Detailed results
[lang="es"], lang="es" A lang= value that matches an identical lang attribute value on the same element will produce styling.
[lang="es"], lang="es" on parent A lang|= value that matches an identical lang attribute value on the parent element will NOT produce styling.
[lang="es"], lang="ES" A lang= value will match a lang attribute value regardless of case differences.
[lang="es"], lang="es-MX" A lang= value will NOT match a lang attribute value when the latter contains additional subtags.
[lang="es-MX"], lang="es" A lang= value will NOT match a lang attribute value when the former contains more subtags.
[lang="es"], lang="mx-es" When the lang= value uses a single subtag, it will NOT match against an attribute value where it appears in a different position.
[lang="en-GB"], lang="en-GB" A lang= value with language and region subtags will match a lang attribute value with the same subtags.
[lang="en-GB"], lang="en-GB-scouse" A lang= value with multiple subtags will NOT match a lang attribute value with multiple subtags if the latter has more subtags, even if the first two subtags are the same.
[lang="en-GB"], lang="en-US" A lang= value and a lang attribute value will NOT match if their region subtags differ.
[lang="az-Arab-IR"], lang="az-Arab-IR" A lang= value with language, script and region subtags will match a lang attribute value with the same language, script and region subtags.
[lang="az-Arab-IR"], lang="az-IR" A lang= value with language, script and region subtags will NOT match a lang attribute value with the script subtag missing.
[lang="cs-CZ"], lang="cs-Latn-CZ" A lang= value with language and region subtags will NOT match a lang attribute value with language, script and region subtags.
[lang="az-Arab-IR"], lang="az-arab-IR" A lang= value will match a lang attribute value regardless of case differences in the script tag.
[lang="es"], xml:lang="es" (html) [Exploratory] A [lang='es'] value that matches an identical xml:lang attribute value will NOT produce styling in pages served as HTML.