{"id":1327,"date":"2010-11-05T17:16:26","date_gmt":"2010-11-05T15:16:26","guid":{"rendered":"https:\/\/www.optimiced.com\/en\/?p=1327"},"modified":"2010-11-10T12:27:58","modified_gmt":"2010-11-10T10:27:58","slug":"target-ie8-ie7-ie6-in-css","status":"publish","type":"post","link":"https:\/\/www.optimiced.com\/en\/2010\/11\/05\/target-ie8-ie7-ie6-in-css\/","title":{"rendered":"Target only IE8, IE7 and IE6 in the CSS code"},"content":{"rendered":"<p>It&#8217;s not a very good idea to &#8220;hack&#8221; the CSS code in such a way so that certain rules will be seen by specific browsers only &#8212; usually, one or more than one version of Internet Explorer (<a href=\"http:\/\/www.quirksmode.org\/css\/condcom.html\">IE Conditional Comments<\/a> are a much better option, in most of the cases).<\/p>\n<p>But sometimes this is the easiest (or the only) way to deal with the situation &#8212; let&#8217;s suppose, for example, that you don&#8217;t have access to the HTML but to the CSS files only. In this case, the following 4 lines of code might be useful:<\/p>\n<p><code><br \/>\nbody {<br \/>\n color: red; \/* all browsers will see this *\/<br \/>\n color : green\\9; \/* IE8 and below *\/<br \/>\n *color : yellow; \/* IE7 and below *\/<br \/>\n _color : orange; \/* IE6 *\/<br \/>\n}<br \/>\n<\/code><\/p>\n<p>As you can see, it&#8217;s easy to write rules that will be &#8220;seen&#8221; only by IE8, IE7 or IE6, or a combination of these three IE versions. And let&#8217;s hope IE9 will need no hacks! ;)<\/p>\n<p><em>(via <a href=\"http:\/\/net.tutsplus.com\/tutorials\/html-css-techniques\/quick-tip-how-to-target-ie6-ie7-and-ie8-uniquely-with-4-characters\/\">#<\/a>)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s not a very good idea to &#8220;hack&#8221; the CSS code in such a way so that certain rules will be seen by specific browsers only &#8212; usually, one or more than one version of Internet Explorer (IE Conditional Comments are a much better option, in most of the cases). But sometimes this is the&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-1327","post","type-post","status-publish","format-standard","hentry","category-css"],"_links":{"self":[{"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/posts\/1327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/comments?post=1327"}],"version-history":[{"count":3,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"predecessor-version":[{"id":1331,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/posts\/1327\/revisions\/1331"}],"wp:attachment":[{"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.optimiced.com\/en\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}