Alex Rivera | Logout

Target IE9 or IE8 but not both using CSS

Asked 2011-05-02T01:18:06.257
10

I know it shouldn't be done, but I just want a quick fix for now and that will give me time to find a proper fix for this.

How can I target IE8 alone using CSS because I've tried appending \9 such as:

margin:100px\9;

However, it also affects IE9 and I don't want that because on IE9 the whole site looks fine.

Edit
Report

1 Answer

9

This should work only in IE9 (and probably newer versions as well):

:root #element-id {
  margin: 400px\9;
}

It is because :root pseudo class is not implemented in versions prior to IE9 (see http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx).

answered 2011-12-07T22:12:31.470

Your Answer