Search code examples
cssinternet-explorer

Conditional comments or IE specific hacks


So in my interweb travels of evaluating other programmer's CSS I've noticed a bunch of people using the underscore or asterisk hack that is vendor specific to IE browsers for debugging purposes though W3C does not parse this as valid CSS.

I personally prefer comment conditionals where you can at least defer to IE specific CSS that is valid but I guess the only issue with that would be addition of extra CSS.

So I'm curious about a consensus of what you prefer and the positive or negative implications of each method.

Comment conditonals or IE vendor specific hacks?

PS - Honestly this should be titled do you support IE layout or not :-)


Solution

  • Conditional style sheets are the way to go. The word hack itself implies that you're doing something that you shouldn't. But a few short words on both:

    Conditional style sheets

    • (+) Cleaner CSS code
    • (+) Easier to manage
    • (+)Easiey to understand for other developers
    • (+) CSS validates
    • (-)More CSS files (thus more server load)

    Hacks

    • (+) Faster (possibly)
    • (-) Messes up your CSS
    • (-) CSS doesn't validate
    • (-) Very unclear for other developers (especially non-experienced one's)
    • (-) Could cause problems with newer versions of IE