:lang() Pseudoclass

Test of Filter

This text will be green if the rule has been applied.

Code Syntax

#testElement:lang(en) {
  color: #00CC00;
}

Browser Support/Behaviour

Applied by:

  • Win/Mac Mozilla 1.6
  • Win/Mac Mozilla 1.2-1.5
  • Windows Opera 8.0
  • Mac OSX Internet Explorer 5.2
  • Mac OSX Opera 8.5
  • Mac OSX Opera 7.5
  • Mac OSX OmniWeb 4.2
  • Mac Classic Internet Explorer 5.1
  • Mac Classic Internet Explorer 5.0

Not applied by:

  • Win/Mac Mozilla 1.0-1.1
  • Windows Internet Explorer 7b
  • Windows Internet Explorer 6.0
  • Windows Internet Explorer 5.5
  • Windows Internet Explorer 5.0
  • Windows Internet Explorer 4.0
  • Windows Netscape 6.0
  • Windows Netscape 4.0
  • Windows Opera 7.5
  • Windows Opera 7.0
  • Windows Opera 6.0
  • Mac OSX Opera 6.0
  • Mac OSX Safari 2.0
  • Mac OSX Safari 1.2
  • Mac OSX Safari 1.1
  • Mac OSX Safari 1.0
  • Mac OSX OmniWeb 5.1
  • Mac Classic Netscape 4.0
  • Mac Classic Opera 6.0
  • Unix Konquerer 3.0

Special Notes

In order for this filter to work in compliant browsers, there must be a lang attribute on an ancestor element of the one being styled (<body>, for instance). Note that the xml:lang attribute on the <html> tag will not trigger this rule. Also, the value of this lang attribute must be repeated between the parenthesis in the :lang() pseudoclass. This rule would probably become messy to implement and maintain in a multilingual document.

More information