5

I found this in a CSS declaration code I am now partially responsible for:

margin: 0 0 0 10px;
*+margin: 4px 0 0 10px;
margin: 3px 0 0 10px\0/;

... the *+ and \0/ are what I'm looking at in particular. What are the hacks being employed here?

And is there a standard place I can look at to look at current and past CSS hacks that also lists their applicability and usefulness? I want to be able at a glance to see a difference between an on-purpose hack and simple code errors.

TylerH
  • 20,799
  • 66
  • 75
  • 101
artlung
  • 33,305
  • 16
  • 69
  • 121
  • Actual testing is leading to confusing results. Test for yourself with http://ipinfo.info/netrenderer/ + http://fiddle.jshell.net/dGrCt/show/light/ – thirtydot May 02 '11 at 17:42
  • 1
    These hacks are more pain than they are worth. They sometimes don't even work and I HATE WITH THE FURY OF A THOUSAND SUNS that many don't validate. It needs to be rewritten with IE conditional comments and tested and retested. – artlung May 02 '11 at 17:46
  • That doesn't even appear to be working as expected. See my previous comment - test with IE7, and the text is black, not red. The accepted answer isn't fully complete/correct. – thirtydot May 02 '11 at 17:48
  • thirtydot, please feel free to reply with an answer that is more correct. I'm aware that these things are not useful. What I need in a reference is to find the hack, and see what prior developers *intended* to target with their stupid hacks. – artlung May 02 '11 at 17:55
  • That's the thing - I can't work out the intent of the author. It seems like perhaps they didn't know what they were doing. IE8/IE9 get declaration 3, IE7/IE6 get *none of the declarations* (you'd expect them to get declaration 2, but they don't), and all other "modern" browsers get declaration 1. – thirtydot May 02 '11 at 17:58

1 Answers1

6
margin: 3px 0 0 10px\0/;

That one is a CSS hack to specify Internet Explorer 8.

*+margin: 4px 0 0 10px;

This one is for Internet Explorer 7

Avisra
  • 740
  • 5
  • 14
  • Great. Is there a good site with listings of these hacks, their age and usefulness? – artlung May 02 '11 at 17:37
  • 1
    Masaul gave a great site - from 2009, but really good. Paul Irish's site, who is a great resource on a number of frontend issues: http://paulirish.com/2009/browser-specific-css-hacks/ – artlung May 02 '11 at 17:40