English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Comprehensive CSS Attributes

CSS :lang() Selector

Complete CSS Selector Reference Manual

Online Example

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 ‹/›

Definition and Usage

: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".

Browser Compatibility

The numbers in the table indicate the first browser version number that supports the attribute.

Selector




:lang()4.08.02.03.19.6

Note: :lang in IE8Running in the middle, must declare<!DOCTYPE>.

Complete CSS Selector Reference Manual