Wednesday, July 8, 2009

xhtml 1.0 vs html 4.01 - My Head Hurts

The hands down winner in my case is xhtml 1.0. I know there’s a lot of debate out there about what Doctype to use, but after running into error after error with html issues, I’m finally mading the switch to xhtml 1.0 and wow, it works! What a concept.

Oh here’s been my dilemma; most of my site was coded in html and I made an initial error on my pages which causes the entire site to be viewed as html 1.0 transitional and an encoding scheme of windows-1252. I found my error and started the massive conversion over to html 4.01 and also fixed the encoding issue to iso-8859-1.

My thought process was simple. If my site was already coded with html tags, why go through the hassle of adding closing forward slash tags, such as page breaks, etc. Simple enough I thought, a few header changes and all would be good. Turns out I was grossly mistaken. Once I made the switch from html 1.0 to html 4.01, all the paragraph segments on my pages lost their formatting. Some worked in Internet Explore while others worked in Firefox. The fundamental problem is, html does not require you to close smart tags, even if you try to force it, sometimes it just doesn’t work.

In my stylesheet, I had my paragraph statement setting the up, down, left, and right margins using the div statement. In IE one paragraph would be ok, followed by the next paragraph; but in Firefox, because there was no paragraph smart tag closure before then next opening p tag. The second paragraph would be shifted over twice; that is it would nest the two smart tags together. Gurrrr! Not want I had intended.

So, in light of these really annoying issues I’m finally making the switch to xhtml 1.0 which does allow me to close the tag when I want, rather then leave it up to the browser. My advice, make the switch! It just makes sense. You get to control when things are open and when they are closed, it’s that simple. And let’s face it, I’m not a true coder by no means. I’m a hardware and EM guy so all of my discoveries here have been extremely painful to include a lot of WTF moments.

Cheers all.

No comments: