Traditionally, web developers have been using either CSS hacks or conditional comments to target different versions of Internet Explorer with CSS fixes. In the last few years more and more people have started using conditional class names, more or less as described by Paul Irish in Conditional Stylesheets vs CSS Hacks? Answer: Neither!.
I've always favoured separating IE fixes from the main CSS by putting them in one or sometimes two separate files loaded via conditional comments. However, a valid argument against that is that keeping the patches in the same file as the main CSS increases maintainability since you're less likely to forget about the patches when updating the main CSS. That problem can be solved by using conditional comments to add class names to the
html element depending on which version of IE is used.
The problem is that it can create plenty of HTML bloat since you need to repeat the opening HTML tag – including any attributes it has – for every version of IE that you want to target. So I started thinking that maybe there is a different way. And there is, though it too has its drawbacks. Nevertheless, here's another way of solving the problem.
Copyright © Roger Johansson