I did give you a couple of examples, but as one reader put it, I really glossed over the idea and I should have spent some more time examining the different types of DOCTYPE values and what they mean.
So rather than jumping right into METATAGS, I'm going to spend a little more time dealing with the DOCTYPE tag.
The World Wide Web Consortium (W3C), in their documentation, does define many different types of HTML - XHTML.
In fact at the time I wrote this, there were 21 different DOCTYPE declarations listed on the W3C's Valid DTD list page.
And I'm quite sure that you could probable find as many more if you looked hard enough, but the one's listed on the W3C's web page are the most common ones currently in use.
Now just to refresh your memory, a Document Type Definition (DOCTYPE) establishes what elements and attributes your document will use and what rules you plan to follow in building your page.
By using the right DOCTYPE you will ensure that your document will be rendered correctly by a standards compliant web browsers.
But what if you don't include a DOCTYPE statement in your document or your DOCTYPE statement is incomplete or incorrect? Well those same standards compliant web browsers will drop into "Quirks" mode and assume that your HTML or XHTML and CSS is non-compliant.
Suffice it to say, you won't get what you thought you should get and your page may not even be readable.
This is obviously not what you want to happen, so using a DOCTYPE statement, and the correct DOCTYPE statement is really important.
Now before we proceed, a word about standards compliant web browsers.
Just because a browser claims to be standards compliant doesn't mean it is.
There are different versions of standards compliant, so some browsers are more compliant than others.
Hopefully, some day all browsers will behave the same, but for the time being that is not true and it is sometimes necessary to include code specifically for one browser so that browser will behave as the other's do.
These little differences have come to be know as hacks and for most programmers are just pains were a pill won't reach.
Ok, you say, what DOCTYPE should I use.
Well as I am writing this, a new standard is emerging: HTML5.
Can I get a few oooo's and ah's.
Now depending on who you talk to, HTML5 is either the best thing to happen to the web or the worst.
And unfortunately, at this time, it's is not fully support by any browser.
Some are getting close, but there is a ways to go.
So it's not something to get overly excited about, but since HTML5 does have some compatibility with HTML4 and XHTML 1, it does mean that we can use the HTML5 DOCTYPE statement, but basically code in HTML4 or XHTML 1.
All this means, by the way, is that as more HTML5 things become available, you won't have to mess around with changing your DOCTYPE statement.
Ok, ok, you say, I get it, so what does the DOCTYPE statement look like? Ok, are you ready? Here it is: [!DOCTYPE html] That's it.
It's that simple! (the [ replaces the < and the ], for the > for the purposes of not screwing up some article directories).
The whole idea is to stop making things so complicated.
So if you take the versioning out of the DOCTYPE statement, then it should be easier to be backward compatible.
We will have to wait on that, but in the meantime, this sure save a lot of typing.
No for those of you that are not convinced, here is the DOCTYPE I normally used until I switched to the HTML5 DOCTYPE: [!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.
0 Transitional//EN" "http://www.
dtd"] This is the DOCTYPE for XHTML 1.
0 - Transitional, and for the most part was the DOCTYPE of choice for most web pages.
It was either this one or the HTML 4.
01 - Transitional DOCTYPE, shown below: [!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.
01 Transitional//EN" "http://www.
dtd"] Now it's interesting to note that the DOCTYPE for HTML5 is listed on the W3C's Valid DTD List page, but it is also noted that it is NOT a standard yet.
Ok, but should you start using the HTML5 DOCTYPE now? The short answer is yes, but it really depends on your site.
But here's something you might want to consider, Google uses the HTML5 DOCTYPE on their main search page.
So even if you don't take advantage of all the new features currently available for HTML5, at least you'll be ready when it takes hold.
In my next article, I will begin to discuss METATAGS and how they should be used in your document's creation, so until next time.