Tiffany B. Brown

A web log about web development and internet culture with frequent detours into other stuff.
New York City: Future of Web Design
Links for 2007-06-30

Open thread: Conditional comments: Yay or Nay?

I’m a big fan of conditional comments. I agree with Jens Meiert that they are non-standard, and don’t adequately separate content and presentation. However, I think they’re the best option we’ve got for one huge reason: it is the only reliable workaround for Internet Explorer that does not also affect other browsers.

The LitePacific hack for example, works well in Internet Explorer 6 and 7, but also affects Safari. If you support Safari, you will also need to create a separate set of style sheet hacks to address differences in the way Safari and IE render pages.

CSS hacks also make your style sheets much harder to read. With conditional comments, you have to maintain multiple style sheets, but each style sheet is cleaner and clearer. Granted, with each new version of Internet Explorer, you have to update your header templates. But updating a header file offers far less risk than integrating new hacks into your style sheets.

Which necessary evil do you prefer? CSS hacks or conditional comments? Speak your piece in the comments.

Share this entry:
  • TwitThis
  • Digg
  • Technorati
  • del.icio.us
  • Ma.gnolia
  • Mixx
  • NewsVine
  • Reddit
  • StumbleUpon
  • TailRank
  • Furl
  • Slashdot
  • Global Grind
  • YahooMyWeb
  • Facebook
  • Google
  • Live
  • LinkedIn
  • MySpace

7 comments

  1. I usually try to stay away from conditional comments, but I’m finding myself using them more and more these days (thanks IE6).

  2. Conditional comments all day. Conditional comments and the IE7 script are like shooting a gallon of penicillin into the booty of IE.

  3. Yay! I’ve done both in-file hacking and conditional comments, and conditional comments keep me much more sane.

  4. I like the idea of conditional comments if you have a lot of alternate CSS needed for either or both IEs. Definitely would make it easy to prune once IE6 goes out of fashion, that’s for sure. However, I’m totally okay with CSS hacks if there’s only a few needed. If my IE stylesheet would end up being only a few kilobytes, the http request needed for IE to grab it would be way more overhead than sticking some of that in the main stylesheet. (This presumes that the user isn’t setting their browser not to cache anything, I know.)

  5. Definatly conditional comments - it means you have a completely valid, standards compliant style sheet at the heart of your site, then the IE nonsense that fixes it - who knows in a few years time we can ditch the conditional comments and your main style sheet will work.

  6. Commenter said on 26 May 2008 at 9:48 am

    Conditional comments all the way!

  7. admin_papa said on 30 Aug 2008 at 10:13 pm

    Hello Everybody

    Just wanted to share my new experience.

    If your Windows XP fails to run due to an error related to lost HAL.DLL, invalid Boot.ini or any other critical system boot files you can fix this by using the XP installation CD. Simply boot from your XP Setup CD and enter the Recovery Console. Then run "attrib -H -R -S" on the C:\Boot.ini file and remove it. Run "Bootcfg /Rebuild" and then Fixboot

    Regards,
    Carl

Leave a Reply


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comments for this post will be closed on 26 February 2009.

Maximum 2 links per comment. Do not use BBCode.
previous post: New York City: Future of Web Design
next post: Links for 2007-06-30