Use the links below to share HTML Transitional What? | The Ins and Outs of HTML Document Type on your favorite social networks.
Back to the Article >>
HTML Transitional What? | The Ins and Outs of HTML Document Type
May 26th, 2008 in Design Tips & Tutorials
by: Matthew Griffin
There's a divisive little tag at the top of every web page called DOCTYPE. It's not divisive because web designers disagree about what should go in that tag or which doctype should be specified (although they argue about that too). It's divisive because half of the web designers barely give a thought to it and the other half would die a bloody death for what's in that tag. Whatever category you happen to fall in, I think you'll appreciate this concise guide to HTML DTDs. Every designer should know the basics and make an informed decision about doctype.
I'm primarily grouping the DTDs by transitional and strict. This seemed like the best route since the differences between HTML and XHTML are pretty simple compared to the differences between transitional and strict. Essentially XHTML is a lower-case, well-formed version of HTML. It comes in handy if you ever want to suck a web page into an XML parser.
It may interest you to know, though, that there will be no more versions of HTML released in the 4.0 series, so XHTML is probably the direction you should be headed (Check this article out if you want to start converting to XHTML). HTML 5 (currently in development), introduces a new spec that will allow both XML and HTML serialization but will significantly change the semantic quality of the markup overall. I won't get too deep into that here but A List Apart has a great article previewing HTML 5 if you want to know more (Thanks to Ville Väisänen for turning me onto the link). Other than that, they're pretty much the same. Okay, let's move on to the complicated stuff.
Transitional Doctypes
HTML 4.01 Transitional and XHTML 1.0 Transitional
The transitional DTDs were developed to help web designers make a gradual transition from HTML 3.2 to HTML 4.01 and XHTML 1.0. Technically, they were meant to be used only temporarily while HTML markup was brought up to the current standards. Since HTML 4.01 and XHTML 1.0 required that all presentation be separated out from content, presentation tags like <font> and <u> were not to be used. Instead, CSS was to be used to add all style to content. But many legacy websites still had the old presentation markup and they needed a way to make the transition gracefully. Here we are, though, eight years after the transitional DTDs were released, and many web designers are still using transitional Doctypes (Myself included).
Standardistas frown on the transitional doctypes and I understand why. The transitional doctypes allow designers to be loose with content/style separation. I believe strongly in this separation but when you're designing in the real world for real clients, there are some cases where it can be difficult. Don't get me wrong, it's not impossible. But I think it's important not to over-complicate something that was originally meant to simplify. I already know I'm going to get into trouble for saying that so go ahead and comment.
Strict Doctypes
HTML 4.01 Strict and XHTML 1.0 Strict
As I mentioned above, the strict DTDs enforce a high level of content/presentation separation (I didn't mean to make that rhyme). The strict doctypes disallow a number of presentation element from HTML 3.2. The illegal tags include the following:
- basefont
- applet
- center
- font
- iframe
- isindex
- menu
- u
- s
- strike
Attributes that are disallowed include the following:
- align (allowed on col, colgroup, tbody, td, tfoot, th, thead, and tr)
- background
- bgcolor
- border (allowed on table)
- height (allowed on img and object)
- hspace
- name
- noshade
- nowrap
- target
- text, link, vlink, and alink
- vspace
- width (allowed on img, object, table, col, and colgroup)
All in all the strict DTDs force good standards and well-formed markup. My hat is off to those of you who use a strict doctype on all of your sites.
It may be hard to believe, but that's pretty much it. When I was doing research for this article, I found several doctype guides that were easily four or five times as long as this one. Writers who take on this subject tend to do so for philosophical reasons which leads to long paragraphs about the history of DTDs and the evils of the transitional doctypes. This guide, on the other hand, should give you concise look at the practical use of doctypes. I'll save the esoteric pondering for another day.
- 11 Comments
- 3390 Views