Underscore Hack

Test of Filter

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

Code Syntax

#testElement {
   _color: #00cc00;

Browser Support / Behaviour

Applied By

Not Applied By


Special Notes / Browser Specific Behaviour

Though it is valid with respect to the grammar defined by CSS (CSS 2.1 allows property names that include underscores), this hack doesn't validate because validation is made against a particular CSS standard which includes both grammer and a set of valid properties and related values. Because the underscore turns the property name into something not include in any CSS standard property list, the declaration will not validate.

Standards-compliant browsers will see the underscore as part of the property name and, because the property name is not recognized, the declaration will not be applied (so the text in the example block should be red in compliant browsers).

The hyphen hack is the same hack with the same behaviour across browsers. The only difference is the character used.

Possible Validating Alternatives

With the exception of IE 5.1 - 5.2 on the Mac, the Star HTML hack has the same browser-support profile.

More information