Is it wrong to use conditional comments?
Conditional comments are specially formatted comments not normally parsed by HTML browsers that allows you to have certain sections of your code read by certain browsers or not. Importantly, though, conditional comments only work in IE!
<!--[if IE]> IE only content or tags. <![endif]-->
However, is it wrong to use these tags?
Personally, I believe so. Primarily, because they go against web standards. The HTML 4.01 specification states that “Information that appears between comments has no special meaning” – so no matter what you put between the it shouldn’t change in any way the appearance of your page. Conditional comments, however, do – against the specification.
Beside this, I am of the opinion that conditional comments lead to bad coding practices. It should never be impossible to get a web document to look the same in all browsers without the use of browser-specific code, and using such code as conditional comments is a lazy opt-out.
I have also seen comments, which I believe are true, that conditional comments violate the goal of separation bewteen structure and presentation in your markup. Conditional comments are not used for structure, they are most of the time used to change the way your page appears in IE and other browsers. So if different code must really be used for IE, then it should be done through the stylesheet or scripting – not through conditional comments.
Finally, they are proprietory tags, not supposed by the majority of browsers on the market today. By supporting them, we continue to send a note of acceptance to Microsoft that we continue to work by their rules, and give less impetus for them to create proper standards-compliant browsers.
So let us look to a brighter future, and not get bogged down in the murky past of conditional comments.