PSEUDO-CLASSES: lang

lang(language code)
 
Compatibility: Currently not supported by any browser
Version: Level 2
 
The lang pseudo-class is used to apply style to the contents of an element which is written in a foreign language. You must declare the language code be enclosing the language code within a pair of parentheses.
 
The language code is set by the ISO 639 and RFC 1776 standards.
 
You can select the language for the element or document by:
  • setting the language in the HTTP header,
  • or by using the lang attribute that is available in HTML and XHTML,
  • or by using a meta element that is available in HTML and XHTML.
A pseudo-class is assigned to a selector via following syntax:
 
selector:pseudo-class(language code) { property: value; ...; }
 
A pseudo-class can also be used with the value assigned as a class to a selector:
 
selector.class:pseudo-class(language code) { property: value; ...; }
 
Code:
<html>
<head>
<title>lang test</title>
<style type="text/css">
p:lang(fr) {color: red;} </style>
</head>
<body>
<p lang="fr">
Bonjour le monde!
</p>
</body>
</html>

 
Simulated output.
 
Output:
Bonjour le monde!


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information