I Vote Conditional Comments

Many developers agree that CSS hacks are not the way to go. Personally, I am on that side of the fence and have been for a long time. I will spend time reworking the style of a document so that it will be cross-browser compatible with no CSS hacks in place. I do this because using CSS hacks is taking a step back.

Whats Wrong with CSS Hacks?

CSS is supposed to enhance the organization of your document and help as much as possible with maintenence. With the release of a new browser (read IE7) you should not have to worry about site compatibility. I think for those who supported CSS hacks in the past, the release of IE7 will help enforce the fact that they are not such a great idea.

CSS hacks make your style unstable, unclean, and difficult to manage. When a stylesheet is bombarded with CSS hacks it no longer looks like an effective document, but more like a jumbled foreign language. I feel that it would be better to have two separate CSS documents written as intended — hack free.

What is an alternative?

In my personal opinion, I think the way to go would be following Microsoft’s advice and giving Internet Explorer the crutch it needs using conditional comments. I think it is the cleanest way to handle IE’s shortcomings while keeping your primary style clean and organized.

Using conditional comments allows you to write your primary stylesheet for an upper level browser, and then write a separate stylesheet that will only apply to IE via conditional comments. For example:

<link href="style.css" type="text/css" rel="stylesheet" media="screen,projection" />
<!--[if IE]><link href="ie_style.css" type="text/css" rel="stylesheet" media="screen,projection" /><![endif]-->

As you can see, using this method would allow you to first develop in a higher level browser, and then compensate for Internet Explorer using a separate stylesheet which would be applied after the original, and compensate.

Microsoft has also provided a way for version control, which can come in very handy when making adjustments for a new version.

But There Are Already IE7 Hacks

I am dissapointed that people actually put time into researching IE7 hacks. That article was released with the understanding that hacks were not the way to go, but the information is included anyway.

Perhaps it is a good way to look into the pitfalls still present in the latest version of our favorite browser, but that is the furthest the information should go. Unfortunately I see it being used time and time again until the next release of Internet Explorer.