Kathleen's Spider Web
~~Kathleen
Anderson, Spider
Web Woman Designs
DOCTYPE Discussion
Happy
New Year!
Before
we get started, I have to give you an update on Bobby (ABC,
Vol. 4). Unfortunately, the downloadable version of Bobby is no longer
free. CAST, the organization that developed Bobby, is now charging $99 for
a single-user copy (they also have site licenses available). You can read more
about this at their
site.
In
this article we are going to discuss the DOCTYPE declaration, also known as a
Document Type Declaration. In Internet Explorer, do a View | Source on a web
page and you should see, at the very top of the page, a statement that looks
something like this:
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
HTML
standards require that you include this statement in all your HTML documents.
Why? One reason is that it tells a validator which HTML specification to use
when validating your page (see Resources at the end of this article for the best
known validators). The other reason is that, new versions of browsers are
finally starting to use the DTD to determine how to render your pages. These
browsers include IE 5 for the Mac, Netscape 6, and Mozilla. Internet Explorer
for the Mac features a new rendering engine, "Tasman", provides full
support for the published Internet content standards as defined by the World
Wide Web Consortium (W3C)! Netscape 6 (currently at version 6.2) appears to be
much less quirky than Netscape 4.7. And then there’s my personal favorite –
Opera – IMHO, the most standards compliant browser on the market today.
Why
use the Transitional declaration, instead of Strict? HTML 4 Transitional
includes all elements and attributes of HTML 4 Strict but adds presentational
attributes, deprecated elements, and link targets. HTML 4 Transitional
recognizes the relatively poor browser support for style sheets, allowing many
HTML presentation features to be used as a transition towards HTML 4 Strict.
If
you are using Frames, this is the DOCTYPE for frames pages:
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
If
you’re using FrontPage, you’ve probably noticed that FrontPage, by default,
doesn’t code a DOCTYPE in your pages. Here’s how you can get around
this:
In
Microsoft FrontPage, there is a file on your computer that is used as the
'template' for the new_page_1.htm that's created either when you open your web
or when you hit the "New Page" button. The file is called "Normal.htm".
In
a normal install of FrontPage 2000 and 2002, this file is in C:\Program
Files\Microsoft Office\Templates\1033\Pages\ normal.tem\
You
can open this file in FrontPage and edit it like you would any other web page.
Navigate to the directory where the file is located, open the file and choose
File | Properties. You can add things that you want to be common to all
the new web pages you create from this point on in all your webs, like your Meta
tags for Author, Copyright, Rating, etc., and DOCTYPE.
Here's
a DOCTYPE statement that you can copy and paste into the template, it goes
before the <html> tag (in HTML View). The DOCTYPE statement must be at the
very beginning of your HTML. To see what I mean, do a View | Source on this
page.
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
When
you've added it, do a File | Save As Normal.htm (Yes, you want to overwrite the
file). From that point on, every new page you create will have a valid DOCTYPE
declaration.
Known
exceptions:
-
When
you create a new web and a home page is created for that web (either
index.htm or Default.htm), it doesn't appear that the Normal.htm file gets
used as a template.
-
In
FrontPage 2002, there are several wizards you can use to create a new web -
these wizards do not use the Normal.htm file as a template when creating the
new web.
For
pages you’ve already created, you can use ErrOmi to find the pages that need
one added. If you are using FrontPage 2000, ErrOmi will warn you about missing
DOCTYPES. If you’re using FrontPage 2002, ErrOmi will actually add the missing
DOCTYPE for you!
Resources
(all free):
W3C
HTML Validator
Web
Design Group (WDG) HTML Validator
NetMechanic
Toolbox
IE
5 for the Mac
Netscape
6.2
Opera
Browser
Mozilla
ErrOmi
Kathleen
Anderson is a webmaster at the State
of Connecticut and chairs their committee on web site accessibility
for persons with disabilities. She also has her own web design company, Spider
Web Woman Designs.