Which Doctype is for me?
June 25th, 2008
This is yet another thing that has been bothering me for quite some time now, that I just haven’t had the will power to address it. Well, I think it has pushed me over the edge. Why are people using Transitional DOCTYPES for new projects?
Stop and think about the title for a minute, would you please!
T-R-A-N-S-I-T-I-O-N-A-L It does not say “use this DOCTYPE if you are lazy“. No. This clearly states that it should be used for, wait for it, transitioning from legacy content that probably did not have a DOCTYPE to begin with, and now does to help give some order to the confusion. They are also there to say “hey, we have some presentational elements mixed within the markup”.
Taken from w3.org
This is the HTML 4.01 Transitional DTD, which includes
presentation attributes and elements that W3C expects to phase out
as support for style sheets matures. Authors should use the Strict
DTD when possible, but may use the Transitional DTD when support
for presentation attribute and elements is required.
When is this required you may ask? As stated above, when you are dealing with legacy content that is out of your control for the most part, as far as formatting goes. This definition clearly tells you out right to use a Strict DOCTYPE when at all possible. Still not convinced?
Write Strict, go Transitional later
If you are designing a site that is going to end up on some CMS, with a lousy good for nothing WYSIWYG editor (like I have been battling for the past 2 years at my current job…) then my hat is off to you and I share in your pain. I still will design the layout with a Strict DTD, saving the Transitional switch for later when it is time to hand the site off to be populated. The CMS we use is out of our hands as far as having access to the formatting of the cotent, for the most part. We have been looking into limiting the editor down to basic functionality.
I can’t tell you how many times I have written extensive style sheets for users, taking careful consideration into all necessary styles that might be needed, and to come back 3 months later and see comic sans font mixed with courier, extra-large bright green font! You destroyed my layout!!! But, as is life, it is out of our hands.
Get to the root of the problem
If you do have access to the way your CMS formats data, you are in luck! Have at it. Get in there and get your hands dirty, to make some clean markup. You will thank yourself now, and the clients will thank you later.
If you are using a database to pull content, and your choice language to format it, even easier. It should not take much to re-work the way things are coming out to conform to a Strict DOCTYPE.
It is just a damn shame to go to some new sites from all the CSS Galleries out there, and to see oh 80-90% of them are using Transitional…WHY! What are you transitioning from? It is a brand new site, so unless transitioning to you means copying & pasting from Word, get a Strict DTD in there!
I will always give the author the benefit of the doubt and read through their markup a little bit, just to see why they might chose this burden, and most of the time I cannot find any good reason. Don’t choose Transitional based on your skill set, have some confidence. Producing good clean markup using a Strict DTD will help you out in the long run. You are basically writing yourself a ticket to any media you wish to display your site on. It will force you to become more independent of vices or clutches you used to use (like tables!).
If your site does not validate, take a minute or two to look up why exactly, and how you can fix it. That way the next time you run into this issue, you will know what is wrong, and nip it in the bud before it gets out of hand.
HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
If you use a Transitional DOCTYPE, please let me know why. I would love to know your reasoning.
- Posted at 9:49 am in web design
- Leave a comment