Posted By

xida on 11/16/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

chchrist


CSS Browser Switches / Hacks


 / Published in: CSS
 

URL: http://www.brunildo.org/test/csshacks.html

  1. IE 6 and below
  2. * html {}
  3.  
  4. IE 7 and below
  5. *:first-child+html {} * html {}
  6.  
  7. IE7 standard only
  8. *:first-child+html selector { property: value; }
  9.  
  10. IE 7 and modern browsers only
  11. html>body {}
  12.  
  13. /*IE8*/
  14. margin-left /*\**/:20px\9;
  15.  
  16. Modern browsers only (not IE 7)
  17. html>/**/body {}
  18.  
  19. Recent Opera versions 9 and below
  20. html:first-child {}
  21.  
  22.  
  23.  
  24. Did you know that, with the addition of only two characters, you can target both Internet Explorer 6 and 7 in your stylesheets? It’s easy…I’ll show you!
  25.  
  26. At a Glance
  27.  
  28. #someElement {
  29. background: red; /* modern browsers */
  30. *background: green; /* IE 7 and below */
  31. _background: yellow; /* IE6 exclusively */
  32. }

Report this snippet  

You need to login to post a comment.