This site is XHTML 1.1 Valid

I finally got this site to validate! The folks over here were really helpful, and pointed out that I wasn’t assigning values to my objects’ style attributes properly. For example, I was doing:

obj.style.width = 200;

instead of:

obj.style.width = "200px";

The second way is the correct way because it is important to specify units for your attributes. In addition, Firefox won’t parse it because it’s very strict about XHTML and CSS. Furthermore, certain things weren’t where I expected them to be. I was used to writing:

obj.style.height = document.body.scrollHeight;

But that no longer worked (the value being returned was 0). The method that works now is:

obj.style.height = document.body.parentNode.scrollHeight + "px";

You have to add in that “px” because the scroll height doesn’t have any units. Once I made these changes, the site started working and validating perfectly. Thanks a bunch to all those who helped!

I guess I did most of this just to jump on the bandwagon and because it did have a “geek” factor. But eitherway, since my website adheres to the standards now, I can be reasonably sure that it looks like the way it should… except for IE though. IE lets you get away with almost anything, and that’s why 90% of the websites out there have such terrible code. IE is very forgiving and can recover from bad HTML, but that only encourages sloppy coding. But anway, now that my site validates, I can proudly display the W3C’s “Valid XHTML 1.1” icon!