IE 7

I don’t know if I hacked my theme to work in IE or if I just made the CSS correct finally. It’s tough to tell when you only have sk1llz. IE6 won’t render transparent pngs so I just did a CSS hack for a black background. Still looks okay for those users I feel sorry for.
Picture 2.png

About the Author, Dan Cameron:

I'm the owner and solution engineer at Sprout Venture, a web solutions company that specializes in web development including WordPress.

I started my first blog in 2003 and transitioned to WordPress in 2004. Since moving to WordPress I've written a few plugins and themes for public consumption. Lately I'm busy engineering/building/coding and have only been able to share a few code snippets.

If you're in need of some web development, web design or custom WordPress plugins and/or themes contact me, I'll be happy to discuss it with you.

Read More »

  • I don't think I talked about conditional comments in that original discussion. It might have been before I was aware of them. I do think it's OK to use this technique, since it's an intended feature that is guaranteed not to break in other standards compliant browsers, and it's forwards compatible, meaning you can write a workaround for IE 6 and below that won't get jacked up when people start using IE7.
  • Dan
    It's also funny to read those comments of Jared's about browser detection; guess it's fine now to use it for style sheets.
  • Dan
    What, I learned about CC way back here which you were part of the discussion. Although you probably didn't care how it was done.
  • nstryker
    today i know something i didn't know yesterday.
  • Dan
    Statements, comments; always forget that.
  • You could always do browser detection (at least of this nature - what version of IE they're running) at the server side without requiring any javascript, but the technique I'm talking about is conditional comments.

    As described in that link, it's a mechanism (officially supported by IE as opposed to hacks) which allows you to add stuff to the page inside specially formatted HTML comments, so that all other browsers will ignore it and IE will pick it up. You can use this to reliably put script or CSS (or links to script/CSS files) that will only ever be read by the version of Internet Explorer that you're targeting.

    The great thing is that it doesn't require anything special (javascript or non-standard / "hacked" CSS), and it is automatically ignored by all other browsers.
  • Dan
    Conditional statements. No?
  • nstryker
    how are you doing a browser detect without js?
  • Sure, it definitely sucks, but for now I think any web developer that wants to make their work accessible to the general public pretty much has to support IE, so I think it's a good idea to do it "right" - meaning, of course, the way I think it should be done. :)
  • Dan
    My sentiments exactly. It's all "poop" anyways.
  • Seems like it would be a lot easier to just have one additional file to manage IE specific settings all in one place which only gets applied to IE (by specific version number or ranges of versions if you want). I don't see how it's hard to add a link to another CSS file; it's a one line change in your template.

    Having hacks sprinkled throughout your primary CSS file is a much bigger issue for me, for a lot of reasons I've mentioned before (unintended consequences in other browsers, lack of forward compatibility, etc.)

    As for having javascript write the style to the page, that would work too, but then you would be requiring users to have javascript enabled, which some may not, especially in IE with the related security issues that keep pooping up.
  • nstryker
    why not just have a js write the code on the page then?
  • Dan
    I know, I know. But I'm not going to create a seperate css file just to put background: #000;
  • It's all about conditional comments - down with hacks!
blog comments powered by Disqus