[thelist] star-hacks vs conditional comments

Symeon Charalabides symeon at systasis.com
Mon Jan 19 10:39:50 CST 2009


Hi Erika,

Belated reply here but since conditional comments became available, I switched to those and never looked back. For me, the major attraction was keeping hacks (that were getting more elaborate by the day) out of my CSS. It turned out there were a few other advantages to the technique:

1. You basically have a main stylesheet for standards-compliant (or mostly) browsers, and a couple of additional ones for the kinkier ones. In that sense, you can actually write CSS in the main stylesheet without having to check every 2 seconds to see how it will turn out. As regarsds the IE stylesheets, yes, they're an adventure.

2. Users of good browsers only have to download the one stylesheet. It's IE users who get ladden with the extra overhead of the extra stylesheet(s) which a) they more or less deserve and b) may be seen as a minimal reason to switch to a good browser. Well... not really, but it's nice to think of it this way.

3 things I'd highly recommend are:

1. Create your first extra stylesheet for all IEs (<=7 until 8 is out). IE7 has a few bugs of its own but, by and large, most of its CSS bugs are inherited from earlier versions. That is, if you correct a CSS bug for IE7, you'd probably need to correct it for all earlier IEs as well, so you may as well include that stylesheet on all of them. When that is done, and you want to support IE6, create another one for <=6, and so on (although you should really stop there).

2. I've found that ordering the CSS rules alphabetically on the IE stylesheets, as I do with the main stylesheet, doesn't work very well because you're not always overwriting existing elements, and because a lot of the bug fixes require multiple CSS rules. I prefer to keep those together, so now my IE stylesheets are groups of 2-3 (usually) rules, preceeded by a comment that describes which particular bug these lines fix, and how (if applicable).

3. (Obvious, but just in case...) Just overwrite/change the rules you need to, do not duplicate the whole main stylesheet ;-)

>  Since I currently and generally develop on a Mac, I have to move to a
>  different machine to check IE, so for a simple site I generally only
>  check IE after a the main structure of a layout is complete, and if that
>  goes well, later after the bells and whistles are added.  To me, the
>  idea of keeping all IE-specific styles 1. minimal and 2. out of the way
>  of my "real" stylesheet, is desirable.   Also, I tend to separate styles
>  out anyway (structure -> color/type -> whatever).  So it makes sense to
>  my brain.

My... 5-ish cents,

Symeon Charalabides (cosmopolite trainee)
-----------------------------------------
http://www.systasis.com



More information about the thelist mailing list