Killersites Forum Blog – HTML or XHTML?

Hey Everyone,

In this week’s forum blog, we look at a post explaining the difference between HTML and XHTML. From our Killersites Community Forum!


One of the most important cornerstones to Accessibility is using W3C Standards. That means you need to understand them as well. No small feet.

Clearly the first stop is the W3C (World Wide Web Consortium) itself.

So what language to use? Short answer, whichever you prefer, but here is what you should consider. Below you will find some good links on these subjects.


Html is still a Standard and the newest version of HTML available. Some still believe that XHTML replaced HTML (something I believed 1 1/2 years ago as well) and HTML is retired. Wrong.

HTML 4.1 and XHTML 1.0 were both released in 1999 and are equal standards, niether better or worse than the other. HTML is fine to use and no reason not to.

What I would strongly suggest is that you however serve it with the Strict DOCTYPE. That is how it is meant to be served, that is pure HTML as it is meant to be written. But more on Strict and Transitional another time.

Also I strongly suggest you write HTML as close to XHTML as you can to get into the habit. This means always write in lower case, never should any element, attribute or name ever start with a capital letter, that should be avoided. Also be sure to wrap all attributes in “”, so rather than Border=1, write border=”1″.

XHTML is falsely understood by many to be a later version of HTML that looks a little like XML (Extensible Markup Language). Wrong!

XHTML is a XML Language that is formatted to look like HTML. But being XML it requires lower case names and all tags must be closed including empty tags like

Now it gets complicated.

XHTML 1.0 – A very morphed version. It was created to “Help” us get used to XHTML ad XML. But it is very backwards compatible. It even carried forward that bad W3C habit of Frame, Transitional and Strict DOCTYPES. It is a very lax language you can even serve as HTML.

XHTML 1.1 – A step to real XHTML, very modulerized. No longer has Transitional, Frame and Srict DOCTYPE, it is simpy strict. It must be served as application/xhtml+xml.

XHTML 2.0 – Not released yet, this is not compatible with HTML at all. Must be served as application/xhtml+xmll.

Also such JavaScript such as document.write() will not work in XHTML served as XML, you will have to learn to create JavaScript with the DOM (Document Object Model).

You will also no longer be able to hide CSS in your pages as the SGML style comments no longer work (), nor can you use inline styles anymore. So all CSS must be in either external sheets or in the head using , this is more trouble then likey worth it so best to simply use external style sheets.

So that brings me to TagSoup.
Tag Soup is serving XHTML as HTML. You see when a page is requested it goes to a server with a “Header” that explains what language it accepts. HTML is served as text/html.

Now when I write a simple XHTML page, it is still being served as text/html. It is written as XHTML but served as poorly written HTML. This works with XHTML 1.0 but not the others.

The problem comes with serving XHTML correctly as XML. IE does not understand that and tries to download the page! So to work in IE you have to use “Content negotiation”. For instance a PHP script that says if it accepts application/xhtml+xml, if not it serves it to IE as text/html.

Also when served as XML, you can no longer use such things as for comments as that is HTML and not XML. I you use XML comments and serve it as HTML, those comments will show.

So at this point XHTML is not truelly supported. You can write XHTML but by servig it as HTML you loose all advantages like working with MathML or SVG.

So when it is all accounted for, the trouble of working with correctly served XHTML with todays browsers…. it is not really worth it.

If you are just doing a simple site with no need for SVG or MathML and such things, then it is fine and easier to use HTML, just do it Strict as it was meant to be used and keep coding as close to XHTML as you can with lower case and “” wraped attributes.

Written by: Kyle(LSW)

You can take a look and get involved with the original post and discussions here!

Happy Holidays!