Fćrslur sunnudaginn 23. nóvember 2003

At 15:42: 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 relatively simple 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:

    1. IE/Win applies all rules starting with underscore. IE on Windows doesn't respect the !important keyword in this context.
    2. IE6.0 has a comment parsing bug that makes it ignore everything after the /**/ part.
    3. All other browsers respect the !important keyword and thus ignore the second width declaration.
  • 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.

Reader comments (1) | Permalink


 

Flakk um vefsvćđiđ



 

Fćrslur í nóvember 2003

nóvember 2003
SunMán ŢriMiđ FimFös Lau
            1.
2. 3. 4. 5. 6. 7. 8.
9. 10. 11. 12. 13. 14. 15.
16. 17. 18. 19. 20. 21. 22.
23. 24. 25. 26. 27. 28. 29.
30.            

Nýleg svör frá lesendum

  • Stefán (Hugmynd ađ gjörningi)
  • mylotarg drug (HOWTO: Fix the hCalendar and hCard accessibility and i18n problems)
  • mylotarg drug (HOWTO: Fix the hCalendar and hCard accessibility and i18n problems)
  • pamelaanderson (HOWTO: Fix the hCalendar and hCard accessibility and i18n problems)
  • Production Music (Íslenskt leitarvélaspam?)
  • ma801zda (Vélrćnar ţýđingar)
  • tapasbocnoa (HOWTO: Fix the hCalendar and hCard accessibility and i18n problems)
  • Siggi Palli (Vélrćnar ţýđingar)
  • Bjarni Rúnar (HOWTO: Fix the hCalendar and hCard accessibility and i18n problems)
  • Unnur María (Vélrćnar ţýđingar)
  • Már (Vélrćnar ţýđingar)
  • Valdís (Vélrćnar ţýđingar)
  • Már (Vélrćnar ţýđingar)
  • Hrafnkell (Vélrćnar ţýđingar)
  • Már (Vélrćnar ţýđingar)

 

 

Yfirlit yfir ţetta skjal

(Atriđin í listanum vísa á ákveđna kafla ofar á síđunni.)