All Hail the CSS Underscore Hack
Petr 'Pixy': The Underscore CSS Hack. This simple hack targets IE5.0 and above on Windows only and is a pleasant addition to the ever growing arsenal of simple CSS hacks that target various versions of IE on Windows and MacOS. Here's a quick run-through of these:
The "star html" hack targets IE5.0 and above on both Windows and MacOS.
Then there's also an equally
relativelysimple hack to target only IE5.0 and IE5.5 on Windows:.test { padding : 10px;width : 180px !important; width /**/: 200px;width : 180px; _width /**/: 200px; }Explanation of how this works:
- IE/Win applies all rules starting with underscore.
IE on Windows doesn't respect the!importantkeyword in this context. - IE6.0 has a comment parsing bug that makes it ignore everything after the
/**/part. All other browsers respect the!importantkeyword and thus ignore the secondwidthdeclaration.
- IE/Win applies all rules starting with underscore.
Then, finally, there's the class-name white-space parsing bug that that may be used to target IE5 on the Mac only.
P.S. The Underscore hack doesn't pass through W3C's CSS validator, but as explained by Petr 'Pixy' Staníček that's because the validator is broken - not the code.
More like this: English Entries, .
Már Örlygsson



Reader Comments (1)
Zato replies:
Hvernig getur eitt fyrirtćki (veriđ er ađ tala um Micro Soft) veriđ svona lélegt en samt áhrifa mikiđ.
Ég fć bara svoleis tár í augun ţetta er svo sorglegt.
November 27. 2003 kl. 12:52 GMT | #