English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Complete CSS Selector Reference Manual
The style selected for each <p> element whose lang attribute value equals "it(Italian)":
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial(oldtoolbag.com)</title> <style> p:lang(it) { background:orange; } </style> </head> <body> <p>I live in Italy./p> <p>I live in Italy./p> <p lang="it">Ciao bella!/p> <p><b>Notice:</b> :lang acts on IE8, DOCTYPE must have been declared.</p> </body> </html>Test to see ‹/›
:lang adds styles to elements that start with the specified lang attribute.
Note: The value is the whole word, like lang="en" alone, or use hyphen (-)like lang ="en-us".
The numbers in the table indicate the first browser version number that supports the attribute.
Selector | |||||
---|---|---|---|---|---|
:lang() | 4.0 | 8.0 | 2.0 | 3.1 | 9.6 |
Note: :lang in IE8Running in the middle, must declare<!DOCTYPE>.