An HTML file that starts <html> and ends in </html> is understood by any browser. But it is better to specify the version you use at the top of the file. You can do that using DOCTYPE, as the very first line of the file. This tells a syntax checking program what to expect, and which syntax rules to check. In the case of HTML version 4 there are three different shapes the DOCTYPE line can take:
See also Dan's Web Tips: Validators about this.
The first possibility, the strict one, is for HTML that adheres strictly to the rules for version 4. That means all lay-out and formatting are done using CSS, and the HTML itself contains no presentation matters. It also means hyperlinks are not allowed to contain a TARGET, which renders frames practically unusable.
For HTML that less strictly follows the standard, there is a
second possibility, version "4 transitional"
with DTD "loose.dtd".
(The DTD - Document Type Definition - is a definition of what is and is not allowed, to be used by the checking program and by browsers).
In an HTML file that describes framesets, so it contains no body, the DOCTYPE should also indicate that fact. This is what the third entry above is for.
After the DOCTYPE, as mentioned before, we have the rest of
the file, between <html> and </html>.
Enclosed by those tags there is a head (between <head> and
</head>) and a
body (enclosed by <body> and </body>).
You may want to read the explanation the World Wide Web consortium "w3.org" gives about this.
The head contains a LINK to the style sheet,
and a TITLE - the browser normally displays that at the top of
the screen, and search engines like
Google use it.
It is also a good idea to specify which character set is used,
for example ISO-8859-1, which covers most West and North European
which offers many more possibilities.
Specifying ISO-8859-1 can be done as follows:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
The body contains the actual text etc. of the document.
Previous Start Next