Copyright © 2010 Olebox – Shaun Oleson. All Rights Reserved. Snowblind by Themes by bavotasan.com. Powered by WordPress.
While I’m always learning new techniques, some of these have been around for quite a while. I have found some common issues with W3C compliance and XHTML. Most are simple case-sensitivity issues.
First, I feel the need to remind you that the XHTML 1 DOCTYPE is very similar to HTML 4. The internet gods are no longer building on HTML 4. Moving forward, updates will be done to the XHTML DOCTYPE. It’s also important to understand there are 3 types of XHTML 1: Strict, Transitional and Frameset. For the purposes of this post, I will be referring to the Strict Doctype. I personally prefer this doctype as it tends to lead to the best cross-browser friendliness.
According to the W3C, the XHTML doctype is an XML application. This means that adherence to syntax requirements is imperative. First, all elements and attribute names must be in lower case characters. Although, HTML 4 would allow some overlapping of elements, it is not permitted in XHTML 1.
<span><p></span></p> <!– INCORRECT
<span><p></p></span> <!– CORRECT
In HTML 4, attribute values could be specified without quotes. This is not the case in XHTML 1. All attribute values must be quoted. In the following example, you’ll notice that the size attribute requires quotes.
<input id=”textbox” type=”text” size=10 /> <!– INCORRECT
<input id=”textbox” type=”text” size=”10″ /> <!– CORRECT
Where previously you could use minimized atrubutes, you cannot in XHTML 1. In the following example, the checkbox attribute must include a value (true/false).
<input id=”checkbox” type=”checkbox” checked /> <!– INCORRECT
<input id=”checkbox” type=”checkbox” checked=”true” /> <!– CORRECT
Another change is that empty elements must be closed. In the following example, the input element needs to either have a closing tag or end with />.
<input id=”textbox” type=”text” size=”10″ > <!– INCORRECT
<input id=”textbox” type=”text” size=”10″ /> <!– CORRECT
<input id=”textbox” type=”text” size=”10″ ></input> <!– CORRECT
A big change is the deprecation of the name attribute. In HTML 4, the id attribute was added. So to conform to W3C standards, the name attribute is being replaced with the id atttribute. See the below example.
<input name=”textbox” type=”text” size=”10″ > <!– INCORRECT
<input id=”textbox” type=”text” size=”10″ /> <!– CORRECT
These are not all of the differences, but it covers the most commonly seen issues. If you would like to read more on the XHTML 1 changes/requirements, check out the W3C website. Surprisingly, it’s not that difficult to understand.
My most common mistakes have been case sensitivity and removing the name attribute from my markup. I have become accustomed to adding both a name and an id. As a reminder, this is incorrect, you can only use the id attribute to validate with the W3C.

