DocType declarations

by Joe Gillespie — Mar 1, 2001

Every Web page should start off with a DocType declaration to tell the browser how to handle the HTML (or other markup language). At the top of the source code of this page is:-

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

which says that the page conforms to HTML Version 4.0. The terms 'Transitional' and 'loose' means that it is not strictly HTML 4.0 compliant as it still uses some tags that are perfectly acceptable to current browsers, but might not be in the future. The browsers we have today are fairly forgiving about sloppy source code, but you can't count on that continuing much longer. Already, pages are falling over in Netscape 6 because it is stricter and truer to standards.

At the moment, most Web design editing programs don't add the DocType automatically so you will have to add it yourself.

If you use Dreamweaver, you can edit the 'Default .html' file which you will find in the 'Templates' folder inside the 'Configuration' folder. Just add the DocType right at the top before the first <HTML> tag. After that, every time you create a new page, it will have the DocType declaration at the top.

In other programs, you will have to enter it manually or copy and paste.

Read more about DocTypes at the W3C site.

Del.icio.us Digg Technorati Blinklist Furl reddit Design Float