Yes, you can have fully compliant code, and keep the cruft for IE6 in a separate file (normally):
Just hide any IE6 specific code with IE conditional statements. This is the preferred way to do it if you want your CSS to still validate. Additionally, all valid HTML should work fine in IE6 with the proper styling applied via CSS:
<!--[if lte IE 6]>
<link rel="stylesheet" href="/css/ie6.css" type="text/css" media="screen" />
<![endif]-->
That will be hidden from all validators, and the rest of your code can remain valid.
In fact, since the conditional comment is just that, a HTML comment, even that code is still valid.
EDIT:
The only way to prove this would be to build an example, but all three are possible with IE6 and proper knowledge in coding.
- Semantic Code: YES
- Validating Code: YES
- Works in IE6: YES
In fact, its not just IE6 that presents a problem with valid code but both IE6 and IE7 (and IE8), but again, only in the CSS. Validate your main CSS files but keep IE6 CSS separate with conditionals.
Rarely do I have to add extra markup to the HTML to support IE6 (other than conditionals in the head
). It is simply a matter of understanding the box model, and building your semantic pages accordingly.
One or two divs
are not evil if they present a proper grouping. Three nested divs
to fix a bug
is evil :)