Only sixpence ha'penny. Bring back the half-crown.
2nd July 2008
The DOCTYPE declaration is the bit that goes at the top of any html document and it tells the browser that this is a web page.
The reason to have a declaration is so that the browser knows what to do with the document. Browsers are able to "display" all sorts of media such as images, film, sound files, animations, pdf files and so on.
Having declared the document as html makes the display and rendering of the page quicker and implements a set of rules for how the page will behave in the browser.
Use valid html
The DOCTYPE declaration should say in detail that this is "valid" html:
Without specifying a DOCTYPE, your html just isn't valid html and most browsers viewing them will switch to "quirks mode", which means they will make up their own mind on what to do with your code.
This aspect is really important: without using correct html the page won't validate and your carefully constructed page layout and content will be all over the place.
Internet Explorer is particularly noted for this as the html rules it applies are often different from all other more standard well-behaved browsers.
There are a set of standards set out by w3c (the World Wide Web Consortium) which can be viewed in detail on their site.
We use the XHTML 1.0 Strict standard, so the start of the doctype declaration is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
You can set Dreamweaver to produce this as the default document type (DDT) through the Edit > Preferences > New Document dialogue.
Speak the Language
We finish this part off with the language declaration.
You should identify the primary language of a document either through an HTTP header or with the xml:lang attribute inside the opening html tag.
This is as follows for English language :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
That's it. Next up is what's in the header of an html page.
« Back