Dive Into Accessibility

30 days to a more accessible web site

Day 6: Choosing a DOCTYPE

You start your sentences with a capital letter; start your HTML with a DOCTYPE. It's just basic grammar.

Who benefits?

You benefit. Many of the tips in the rest of this series will require you to know what version of HTML you're using, because the instructions will be slightly different. So figure it out now, or add one if you don't have one.

How to do it

You may already have a DOCTYPE. View source on your home page; your DOCTYPE (if you have one) will be at the very top, even before the <html> tag.

If you have a DOCTYPE, don't change it. However, if your source shows no DOCTYPE before your <html> tag, add this one:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

For technical reasons that I would rather not go into at the moment (see the "Further Reading" section below if you're interested), it is possible that you will see slight changes in your page layout after adding this DOCTYPE. If (and only if) this happens to you, you can compromise and use half a DOCTYPE instead, like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Note that every page of your web site should include a DOCTYPE, so you should check all your templates.

The important thing to know for the rest of the series is whether you're using HTML 4 (any variant), XHTML 1.0 (any variant), or XHTML 1.1. You'll see why tomorrow.

Further reading