Accesskey n skips to in-page navigation. Skip to the content start.
These tests check whether various methods of selecting language in CSS selectors work for styling text in HTML and XHTML.
See the results below for user agents tested. This section summarizes the results of those tests. In what follows, 'HTML' means HTML4.01, HTML5 or XHTML 1.0 served as text/html. XML means XHTML 1.0, XHTML5 or XHTML 1.1 served as application/xhtml+xml.
All browsers except IE7 support :lang as expected. IE7 does not support :lang at all (but IE8 does).
All browsers support lang|= and lang= selectors as expected, except for the fact that IE7 doesn't ignore differences in case.
No browser matches collapsed script subtags between language and region subtags.
No browser picks up on CSS selectors using the xml:lang (rather than lang) attribute, and where the lang and xml:lang attribute values differ, the lang value has precedence in all browsers.
All browsers support :lang as expected with xml:lang (although Internet Explorer is excluded from the results, since it does not support XML rendering at all). Surprisingly, however, all browsers tested also supported :lang with a lang attribute. This is surprising because the lang attribute is not yet defined by the XHTML 1.1 syntax (although a PER is about to be published that will change that).
If both lang attribute and xml:lang attribute are present and have differing values, the xml:lang attribute always wins.
They also support XML support xml|lang|= or xml|lang= when used with a namespace declaration. Firefox does, however, apply styling if you omit the namespace declaration - which is not supposed to happen.
Styling using the escaped form, xml\:lang, didn't work. This is to be expected, since all the browsers support namespace declarations.
These are results for the latest versions of each user agent tested. A green background (yes) means that the assertion associated with the test held true; red (no) means that it did not; orange (partially) means that it was only partially true. To view the assertion, mouse over the text in the left column. To see a test, click on a format in the right hand column.
Results are given here for three types of document format: H4 (HTML 4.01), H5 (HTML5), and XH (XHTML 1.0 served as text/html), but since results were the same for the browsers tested, a single cell is used to represent both test instances. For results for XHTML served as XML, see the next section.
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang(es), lang="es"A :lang value that matches an identical lang attribute value will produce styling. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), lang="ES"A :lang value will match a lang attribute value regardless of case differences. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), lang="es-MX"A :lang value will match a lang attribute value when the latter contains additional subtags. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es-MX), lang="es"A :lang value will not match a lang attribute value when the former contains more subtags. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| 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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), lang="en-GB"A :lang value with language and region subtags will match a lang attribute value with the same subtags. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), lang="en-US"A :lang value and a lang attribute value will not match if their region subtags differ. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance by inline elementsWhen styling is defined for a block element using :lang and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using :lang but the language is only declared using a lang attribute on an ancestor element, the styling should still be picked up. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using :lang but the language is only declared using a lang attribute on an ancestor element, the styling should still be picked up. | yes | n/a | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: :lang with lang
Assertion:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang(es), xml:lang="es"A :lang value that matches an identical xml:lang attribute value will produce styling in pages served as XML, but not pages served as HTML. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), xml:lang="ES"A :lang value will match an xml:lang attribute value regardless of case differences. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(es), xml:lang="es-MX"A :lang value will match an xml:lang attribute value when the latter contains additional subtags. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(es-MX), xml:lang="es"A :lang value will not match an xml:lang attribute value when the former contains more subtags. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| lang(es), xml:lang="mx-es"When the :lang value uses a single subtag, it will not match against an xml:lang attribute value where that value appears in a different position. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-GB"A :lang value with language and region subtags will match a xml:lang attribute value with the same subtags. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-GB-scouse"A :lang value with a multiple subtags will match a xml:lang attribute value with multiple subtags as long as the first part is the same. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-US"A :lang value and a xml:lang attribute value will not match if their region subtags differ. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-Arab-IR"A :lang value with language, script and region subtags will match a xml:lang attribute value with the same language, script and region subtags. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-IR"A :lang value with language, script and region subtags will not match a xml:lang attribute value with the script subtag missing. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(cs-CZ), xml:lang="cs-Latn-CZ"A :lang value with language and region subtags will not match a xml:lang attribute value with language, script and region subtags. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-arab-IR"A :lang value will match an xml:lang attribute value regardless of case differences in the script tag. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang, Inheritance by inline elementsWhen styling is defined for a block element using :lang and the xml:lang attribute, the styling should still be picked up by inline elements contained by that block element. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using :lang but the language is only declared using an xml:lang attribute on an ancestor element, the styling should still be picked up. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using :lang but the language is only declared using an xml:lang attribute on an ancestor element, the styling should still be picked up. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
Link to tests: :lang with xml:lang
Assertion:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang, xml:lang vs. langWhen an xml:lang attribute and a lang attribute on the same element have different values, the xml:lang value will match pages served as application/xhtml+xml, and the lang value will match pages served as text/html. | n/a | n/a | n/a1 | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
Link to tests: lang and xml:lang precedence
Assertion:
Notes:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| [lang|="es"], lang="es"A lang|= value that matches an identical lang attribute value will produce styling. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="es"], lang="ES"A lang|= value will match a lang attribute value regardless of case differences. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="es"], lang="es-MX"A lang|= value will match a lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="es-MX"], lang="es"A lang|= value will not match a lang attribute value when the former contains more subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="en-GB"], lang="en-GB"A lang|= value with language and region subtags will match a lang attribute value with the same subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="en-GB"], lang="en-US"A lang|= value and a lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang|=, Inheritance by inline elementsWhen styling is defined for a block element using lang|= and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang|=, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using lang|= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang|=, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using lang|= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang |= with lang
Assertion:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| [xml|lang|="es"], xml:lang="es" with @namespaceAn xml|lang|= selector with an @namespace declaration that matches an identical xml:lang attribute value will produce styling. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| [xml|lang|="es"], xml:lang="es" with no @namespaceAn xml|lang|= selector with no @namespace declaration that matches an identical xml:lang attribute value will not produce styling. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| xml\:lang|=, xml:lang[Exploratory test] An xml\:lang|= selector with a value that matches an xml:lang attribute value will not produce styling for documents served as XML if the browser supports namespace declarations, but will otherwise. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang |= in XML
Assertion:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| [lang="es"], lang="es"A lang= value that matches an identical lang attribute value will produce styling. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="es"], lang="ES"A lang= value will match a lang attribute value regardless of case differences. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="es"], lang="es-MX"A lang= value will not match a lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="es-MX"], lang="es"A lang= value will not match a lang attribute value when the former contains more subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-GB"A lang= value with language and region subtags will match a lang attribute value with the same subtags. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-GB-scouse"A lang= value with a 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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-US"A lang= value and a lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang=, Inheritance by inline elementsWhen styling is defined for a block element using lang= and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang=, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using lang= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang=, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using lang= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang= with lang
Assertion:
| UA | IE | IE | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|---|---|
| version | 8 | 7 | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | 20100521 | |
| [xml|lang="es"], xml:lang="es" with @namespaceAn xml|lang= selector with an @namespace declaration that matches an identical xml:lang attribute value will produce styling. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| [xml|lang="es"], xml:lang="es" with no @namespaceAn xml|lang= selector with no @namespace declaration that matches an identical xml:lang attribute value will not produce styling. | n/a | n/a | n/a | n/a | n/a | n/a | H4 H5 XH X X5 X11 |
| xml\:lang=, xml:lang[Exploratory test] An xml\:lang= selector with a value that matches an xml:lang attribute value will not produce styling for documents served as XML if the browser supports namespace declarations, but will otherwise. | yes | no | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang= in XML
Assertion:
These are results for the latest versions of each user agent tested. A green background (yes) means that the assertion associated with the test held true; red (no) means that it did not; orange (partially) means that it was only partially true. To view the assertion, mouse over the text in the left column. To see a test, click on a format in the right hand column.
Results are given for three types of document format: XX (XHTML 1.0 served as XML), X5 (XHTML5), and X11 (XHTML 1.1, served as XML), but since results were the same for the browsers tested, a single cell is used to represent both test instances. Internet Explorer doesn't handle pages served as XML, so those tests are ignored in these results.
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang(es), lang="es"A :lang value that matches an identical lang attribute value will produce styling. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), lang="ES"A :lang value will match a lang attribute value regardless of case differences. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), lang="es-MX"A :lang value will match a lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es-MX), lang="es"A :lang value will not match a lang attribute value when the former contains more subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| 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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), lang="en-GB"A :lang value with language and region subtags will match a lang attribute value with the same subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), lang="en-US"A :lang value and a lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance by inline elementsWhen styling is defined for a block element using :lang and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using :lang but the language is only declared using a lang attribute on an ancestor element, the styling should still be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using :lang but the language is only declared using a lang attribute on an ancestor element, the styling should still be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: :lang with lang
Assertion:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang(es), xml:lang="es"A :lang value that matches an identical xml:lang attribute value will produce styling in pages served as XML, but not pages served as HTML. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), xml:lang="ES"A :lang value will match an xml:lang attribute value regardless of case differences. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es), xml:lang="es-MX"A :lang value will match an xml:lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(es-MX), xml:lang="es"A :lang value will not match an xml:lang attribute value when the former contains more subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang(es), xml:lang="mx-es"When the :lang value uses a single subtag, it will not match against an xml:lang attribute value where that value appears in a different position. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-GB"A :lang value with language and region subtags will match a xml:lang attribute value with the same subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-GB-scouse"A :lang value with a multiple subtags will match a xml:lang attribute value with multiple subtags as long as the first part is the same. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(en-GB), xml:lang="en-US"A :lang value and a xml:lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-Arab-IR"A :lang value with language, script and region subtags will match a xml:lang attribute value with the same language, script and region subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-IR"A :lang value with language, script and region subtags will not match a xml:lang attribute value with the script subtag missing. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(cs-CZ), xml:lang="cs-Latn-CZ"A :lang value with language and region subtags will not match a xml:lang attribute value with language, script and region subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang(az-Arab-IR), xml:lang="az-arab-IR"A :lang value will match an xml:lang attribute value regardless of case differences in the script tag. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance by inline elementsWhen styling is defined for a block element using :lang and the xml:lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using :lang but the language is only declared using an xml:lang attribute on an ancestor element, the styling should still be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| :lang, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using :lang but the language is only declared using an xml:lang attribute on an ancestor element, the styling should still be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: :lang with xml:lang
Assertion:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| :lang, xml:lang vs. langWhen an xml:lang attribute and a lang attribute on the same element have different values, the xml:lang value will match pages served as application/xhtml+xml, and the lang value will match pages served as text/html. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang and xml:lang precedence
Assertion:
Notes:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| [lang|="es"], lang="es"A lang|= value that matches an identical lang attribute value will produce styling. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="es"], lang="ES"A lang|= value will match a lang attribute value regardless of case differences. | no | no | no | no | H4 H5 XH X X5 X11 |
| [lang|="es"], lang="es-MX"A lang|= value will match a lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="es-MX"], lang="es"A lang|= value will not match a lang attribute value when the former contains more subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="en-GB"], lang="en-GB"A lang|= value with language and region subtags will match a lang attribute value with the same subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang|="en-GB"], lang="en-US"A lang|= value and a lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | no | no | no | no | H4 H5 XH X X5 X11 |
| lang|=, Inheritance by inline elementsWhen styling is defined for a block element using lang|= and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang|=, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using lang|= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang|=, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using lang|= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang |= with lang
Assertion:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| [xml|lang|="es"], xml:lang="es" with @namespaceAn xml|lang|= selector with an @namespace declaration that matches an identical xml:lang attribute value will produce styling. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [xml|lang|="es"], xml:lang="es" with no @namespaceAn xml|lang|= selector with no @namespace declaration that matches an identical xml:lang attribute value will not produce styling. | no | yes | yes | yes | H4 H5 XH X X5 X11 |
| xml\:lang|=, xml:lang[Exploratory test] An xml\:lang|= selector with a value that matches an xml:lang attribute value will not produce styling for documents served as XML if the browser supports namespace declarations, but will otherwise. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang |= in XML
Assertion:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| [lang="es"], lang="es"A lang= value that matches an identical lang attribute value will produce styling. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="es"], lang="ES"A lang= value will match a lang attribute value regardless of case differences. | yes | no | no | no | H4 H5 XH X X5 X11 |
| [lang="es"], lang="es-MX"A lang= value will not match a lang attribute value when the latter contains additional subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="es-MX"], lang="es"A lang= value will not match a lang attribute value when the former contains more subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-GB"A lang= value with language and region subtags will match a lang attribute value with the same subtags. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-GB-scouse"A lang= value with a 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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [lang="en-GB"], lang="en-US"A lang= value and a lang attribute value will not match if their region subtags differ. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [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. | yes | no | no | no | H4 H5 XH X X5 X11 |
| lang=, Inheritance by inline elementsWhen styling is defined for a block element using lang= and the lang attribute, the styling should still be picked up by inline elements contained by that block element. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang=, Inheritance from an ancestor, block elementsWhen styling is defined for a block element using lang= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| lang=, Inheritance from an ancestor, inline elementsWhen styling is defined for an inline element using lang= but the language is only declared using a lang attribute on an ancestor element, the styling should NOT be picked up. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang= with lang
Assertion:
| UA | Firefox | Opera | Safari | Chrome | |
|---|---|---|---|---|---|
| version | 3.6.3 | 10.5.3 | 4.0.5 | 4.1.249.1064 | |
| OS | XP | XP | XP | XP | |
| date | 20100521 | 20100521 | 20100521 | 20100521 | |
| [xml|lang="es"], xml:lang="es" with @namespaceAn xml|lang= selector with an @namespace declaration that matches an identical xml:lang attribute value will produce styling. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
| [xml|lang="es"], xml:lang="es" with no @namespaceAn xml|lang= selector with no @namespace declaration that matches an identical xml:lang attribute value will not produce styling. | no | yes | yes | yes | H4 H5 XH X X5 X11 |
| xml\:lang=, xml:lang[Exploratory test] An xml\:lang= selector with a value that matches an xml:lang attribute value will not produce styling for documents served as XML if the browser supports namespace declarations, but will otherwise. | yes | yes | yes | yes | H4 H5 XH X X5 X11 |
Link to tests: lang= in XML
Assertion:
Tell us what you think (English).
Content first published 2009-04-16. Last substantive update 2009-04-16 8:05 GMT. This version 2009-10-05 15:35 GMT
For the history of document changes, search for results-css-lang in the i18n blog.
Copyright © 2007-2009 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.