One of the Accessites Criteria we insist upon for sites we judge is that they must have a Strict
DOCTYPE. Some people have queried why we insist on this. One answer would be “it’s our site, it’s our rules.” That’s not a very satisfactory answer though. So why should you use a strict
DOCTYPE? Well, we have four reasons.
- First, because the Transitional
DOCTYPEtells you to.
- Second, because it helps separate your presentation from your content.
- Third, because separating your presentation from your content is a good thing to do.
- Finally, because it’s our site so it’s our rules.
DOCTYPE tells you to use a Strict
You may not be aware, unless you’ve read the actual
DOCTYPE documents themselves (and frankly, who wants to do that?) that the HTML 4.01 Transitional
DOCTYPE tells you to avoid using the HTML 4.01 Transitional
DOCTYPE if you can.
“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.” –W3C
There is no direct reference in the XHTML 1.0 Transitional DOCTYPE, but it does point out that it should be treated as HTML Transitional except for changes due to XML.
“This is the same as HTML 4 Transitional except for changes due to the differences between XML and SGML.” –W3C
DOCTYPE forces separation of presentation and content
The elements that are banned by a strict
- Allows you to specify a default size, colour and typeface for the text on your page.
- Allows you to specify a size, colour and typeface for a specific part of your page.
- Creates a div element with an
- Allows you to embed a java applet into your document (deprecated in favour of object).
- Allows you to create types of lists which in practice are usually rendered identically to ul lists.
- Allows you to create a single line input box (deprecated in favour of appropriately used input.
- Allows you to add strike-through effects to your text.
- Allows you to add underline effects to your text.
The effects of all of these elements can either be produced by use of a different element, or by appropriate use of the CSS presentation layer. Banned attributes are similar: the
vspace attributes can all be replicated by the proper use of CSS, which keeps your code and your presentation separate.
Providing you’re wanting to keep your presentation separated from your content, there is no reason why you should need to use a Transitional
DOCTYPE. In fact, I have encountered many sites which are using a Transitional
DOCTYPE unnecessarily — they are not using any presentation and the sites would validate against a Strict
DOCTYPE without needing to change any markup. If you don’t need to use Transitional, why are you doing it?
Separating your presentation from your content is a Good Thing
Most web professionals today understand the reasons to produce sites that separate the content and the presentation. Presentation is provided by cascading style sheets, which allows the user to theoretically override your default settings with a style sheet of their own, whereas your content is the information that should be delivered to every user, regardless of the way they would like it presented.
Separating your content from your presentation makes it faster and easier to change the look of your site, and saving time saves money.
Separating your content from your presentation reduces the amount that needs to be downloaded by your users, because if the CSS is in a separate file it would normally be cached so it will only be downloaded once. Saving the amount downloaded reduces your bandwidth usage, which could again save you money.
The Web Content Accessibility Guidelines tell you to do it as a priority 2 checkpoint : “3.3 Use style sheets to control layout and presentation.”
What about new windows?
The point has been raised that using a Strict DOCTYPE prohibits using the
target attribute, so you can’t use
target="_blank" to have a page open in a new browser window. Now, it’s been said before that opening new windows is bad. It certainly stops commonly relied on things, such as the back button from working. Nonetheless, plenty of sites still continue to want to open new browser windows. Fine. I may disagree with your reasoning on this issue, but that’s not stopping you from using a Strict
So you can still open new windows if you really must, but your site behaviour has now been separated from your site content as well. Doesn’t that make you feel good?
DOCTYPE only removes the chance to use presentational or behavioural elements and attributes. If you aren’t using these anyway — and you shouldn’t be — then you’ve no reason to avoid the Strict
I’ll still let you use a Transitional
DOCTYPE where you need to demonstrate the use of presentational or behavioural attributes or elements. Do we have a deal?
Would you like to view comments on this article?