Question

I'm trying to motivate my team members to get our code to validate, but there seems to be some disillusionment because we are required to still support IE6.

Do you guys have any thoughts to this end?

This is what I'm going for:

  • Semantic code - YES
  • Validating code - YES
  • Works in IE6 - YES

Let's not argue over semantics here lol. =]

HTML JS CSS

Was it helpful?

Solution

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.

  1. Semantic Code: YES
  2. Validating Code: YES
  3. 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 :)

OTHER TIPS

Short answer: yes!

It's been my experience that valid, semantic markup actually works better with IE6. Combine this with correct, valid, and simple CSS and you're pretty much golden. Sure you're bound to encounter some strange behavior in IE6, especially for more complex designs, as noted above. However, most of these bugs are well documented. With simple, valid code, identifying and fixing these issues is often fairly simple.

Conditional comments, as noted above, certainly work, but developing valid code will prevent you from peppering your code with all sorts of conditions.

Still can't make it work? Degrade gracefully! Sure rounded corners are pretty and all the rage, but the 20% (hopefully less) of your users who are still living in the dark ages probably won't miss them.

It's a bit of work to make the code work in IE6, and there is a bit of work to make the code validate, but that doesn't mean that it's the same kind of work or that one of them will make the other impossible.

There isn't really anything that says that the code has to fail validation to work in IE6. On the contrary, code that validates is more likely to work in any browser, not just IE6. There are some IE6 quirks that you can circumvent using non-valid code, but it's not the only method for circumventing the problems. Methods that use valid code are also more likely to continue working when new browser versions are released, so that you don't have to start over for every new browser update.

It's of course easier to make the code work in IE6 if you don't have to think about valid code at the same time, but that's just because there are more factors to consider, not because the factors are incompatible per se.

No, it is not possible for any moderately complex layout.

EDIT: At least not without adding lots of ugly conditionals.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top