Grow your CSS skills. Land your dream job.

Poll Results for Conditional Comments

Published by Chris Coyier

I'm darn proud of you folks today. In the latest poll which asked:

Do you wish there was conditional comments for all browsers?

More than half of you said: No. That's anti-web-standards.

It's like someone dangled a candy bar in front of your face and you said No, I'm on a diet. It's like you didn't jump off the bridge even though all your friends were doing it. It's like you just said no to drugs. It's like you stop drop and rolled. You are heros for the cause.

I'm not blaming anybody for voting the other way, either. It's a poll. I asked you your opinion and you gave it. But you gotta admit it's kinda cool that so many people, when offered something that could help short term problems, gives power to designers, and doesn't have any immediate obvious drawbacks still said no, we don't want it. They were able to consider the long term and decided that if we suddenly started implementing easy ways to target and serve special content to specific browsers that that's a bad thing.

A new poll will replace this one in the sidebar soon.

Comments

  1. I guess it would be great to be able to just be able to target older versions of browsers like Chrome and Firefox that don’t support the latest tricks but in the end serving up good quality HTML and CSS is more important than hunting down solutions to every last little bug that may exist.

    Conversely I have used http://www.modernizr.com/ for a few projects, just to help ease myself into the CSS3 world, I wonder if this counts as being anti web standards?

  2. Permalink to comment#

    Chrome auto-updates. Firefox users pretty much do and aren’t they going to auto-updates? So targeting older browsers isn’t needed for them.

    • Chrome doesn’t auto update on a Mac at least and I’m currently typing from FF4 but I’m quite sure that are still many FF3.6 surfers out there.

    • Permalink to comment#

      I’m one of them… : ) I need to get around to it…

  3. I think it’s best to only target older versions of IE starting from IE6. All other browser users are savvy enough to update them (that’s if the browser doesn’t update itself) and I only support the latest versions of Firefox, Chrome, Opera, Safari… What do you guys think?

    • Even the most modern version of any browser will have a bug here or there. It would be nice to be able to get around it, at least until a new version with a fix is put out.

  4. I wish all browsers had them. It’s funny how proud Chris is of us saying we don’t want them, when in reality, we use them for IE all the time because it’s THE ONLY OR BEST way to solve some problems with IE. Supporting them doesn’t do anything to standards, unless all browser vendors become so lazy that they’ll just say, “Oh, yea, that’s a but, but we’ll just let people use conditional statements to get around it. ”

    In this day and age, I don’t think that would happen…. take IE9 and 10 for example. They still use conditional comments, but are getting more standards compliant all the time.

    All browsers will always have some sort of bug because humans make them. Conditional comments would be a simple and practical way to get around bugs of modern or old browsers… not to deal with lack of effort of standards support, but just inevitable human error.

    • It’s not the only or best way to solve the problem. There’s a myriad of good solutions depending on your problem.

      Just off the top of my head:

      – Using PHP (better)
      – WordPress gives browser detection (along with a lot of other CMS)
      – Javascript has native tools to check browser
      – jQuery has simple ways to check
      – Along with PHP, I can’t think of any server-side language that doesn’t let you check it.

      People use them for IE because it’s convenient, not because it’s the right choice. I’m not saying I haven’t been guilty, I’m just saying there are tons of good solutions out there that don’t involve two bit hacks.

    • Andrea
      Permalink to comment#

      You are getting it wrong. Checking the browser server side is definitely the worst solution you can think of. The only way to do that is through the USER_AGENT header, and that is often altered for various reasons, so it not reliable at all.

      Checking the browser client-side is not a reasonable way, too. There is just no reliable way to do it.

      The best thing you can do is feature detection through Javascript. You just check if you can do something, regardless of the browser. But this is only useful when Javascript is on.

      Conditional comments are the only reliable way to do something browser-specific when Javascript is not necessarily on.

    • also and correct me if i am wrong… but aren’t conditional comments ‘cheaper’ (less server and compure work, less code, less requests …) then using javascript, php or jquerry for the task ?

    • Andrea, That’s the whole debate as to weather they should be used or not, not weather they’re cheaper, which they are.

      I wasn’t advocating one way or another (as you said, I have JavaScript in my list), I just don’t agree the conditional comments are the way.

      I realize I put PHP (better), that was more or less a typo, I meant using an option other than conditional comments was better, not just that one example (as you see I have it in my list twice).

      Also, on the same note that using USER_AGENT isn’t reliable, neither is JavaScript, anyone can alter a request or browsers setting to screw up systems, and there should be redundant checks if it’s a security issue.

  5. Some guy
    Permalink to comment#

    I even used them in some real sites, because I don’t care about IE in that aspect.

    And I will use it on my site, if I manage to make it.

  6. Ryan Donahue
    Permalink to comment#

    While I totally agree with the results of the poll, i think the way the answers were phrased may have cause the results to be skewed a bit. Even if someone didn’t understand the question it was pretty obvious that Yes was considered negative and No was positive.

    Not a huge deal I guess but it makes me wonder if the results would have been as extreme had the options just been…. Yes, No, or I don’t care.

  7. Can we just call a spade a spade. The only real browser that has ALL the issues is IE. And they don’t auto update, and the users who are on IE are generally still using aol.

    Technology is moving to fast not to update so I say, no to old browsers, and it’s time to upgrade already.

    • opera has issues, chrome has issues (a few but they exist), also not all FF users update … its usually a matter of i support this you support that, but there are also some bugs to be found

      – it’s also ok to say upgrade your browser to a computer guy, but you just cant say it to a client that ordered (and payed for) a site …

  8. Permalink to comment#

    its a pain in the butt if you ask me

  9. Permalink to comment#

    This would be one out of many other ways to target browsers. Let’s just face it : we need to target browsers even if the way we do it is non-standard… Well, just because it is to face non-standard behaviors.

  10. I’m all for designers having the say so in what browsers they wish to target. But having dealt with a client who was purely interested in SEO benefits for marketing purposes, you learn real quick that your design has to be as similar as possible in order to un-bias your results. Statistics should drive your decisions for which browsers to support and whether you may omit certain features for the sake of user experience and cross-browser experience.

    But still, a life w/o conditional comments would be more than ideal :) *pipedream*

  11. I would like them, simply to be able to to target the different versions of contenteditable – the differences between the implementations are ridiculous and there is no feature detection! I had to resort to detecting the css prefixes (-moz, -o,-webkit)via javascript (which IMO is better than trying to use the user-agent string).

  12. I wish clients would stop saying things like: “I’m no technician” and “how am I supposed to know that” while still resorting to Windows 2k and IE6.

    IMO we’re summing up a lot of designers wet dreams that won’t see the daylight any time soon.

    Maybe Chris could make a poll about what ways we use most for feature/browser detection?

  13. I guess it would be better if we could detect what was supported directly through conditional statements, instead of detecting the browser.

    That way, even if browsers got updated or new features added (or if features are deducted), we’d still have a bulletproof way to target those.

  14. DatTemsZ
    Permalink to comment#

    The first thought I got after reading this ?

    Chris realized we’re not that dumb after all xD

    J/k thanks for the site dude!

  15. Permalink to comment#

    I almost never use conditional comments (or other browser-targeting hacks) and yet the sites I build display correctly across various browsers. Admittedly, I haven’t supported IE6 for a while unless it is specifically requested (and paid for).

    Pleased with the poll results. I think if we had conditional comments for all browsers it would encourage bad coding and would lead browser vendors to care less about standards because they know devs would use conditionals to fix it.

  16. I have to wonder whether the people that clicked on “Don’t want them” are also thinking in their heads, “I just wish all browsers were standards compliant.”

    As for the dev that doesn’t support IE6, that doesn’t tend to be an option when you’re working for an agency with major clients. Even though our analytics shows that IE6 only accounts for about 2% of their traffic, that’s still better than 3,000 visits a month. Just try to tell a client that “only” 3,000 people each month are going to see a broken or even slightly mis-formatted site. Unfortunately, many of us don’t have the option of snubbing IE6 yet. Conditional statements FTW.

  17. dont get me wrong on my previous comments — i dont wan’t conditionals… or at least i want an enviroment where i wouldn’t want them

    anyways… at the given moment i belive, that we would need just one more and this is … IS WEBKIT ? to allow webkit css and javascript fallbacks, without having webkit browsers load the javascript files …

    • ok … new development so yes conditional comments for ALL browsers indeed –

      basic reason – Chrome and FF dont even display Arial in the same way … result is breaking of lines in diferent places in a narrow column … i mean if is it so hard to have SOME standards then yes – conditional comments plz … ok its all just a rant on a current situation ;)

This comment thread is closed. If you have important information to share, you can always contact me.

*May or may not contain any actual "CSS" or "Tricks".