
The HTML columns in
March's issue of PC User magazine provoked a strong reaction from PC User reader and web
author Robert Eldridge. Robert savaged a section of HTML source created by Rose Vines
WinWord 97 and urged us to make sure web page source should be written "to degrade
gracefully'' in all web browsers.
We thought Robert made
some good points in his email so we invited him to expand on it in this column. We asked
him to share his thoughts on web authoring and, in particular, the pitfalls of using GUI
net tools to create HTML source.
Here are our questions and Robert's
replies.:
Question - Helen & John
Can you give us your line by line critique of the HTML source in the "Not just a
pretty face" box from page 89 of the March issue of PC User magazine? In particular,
would you explain what the correct form should be.
Answer - Robert
I will deal with this in two parts, the head section and the body section. Firstly the
head:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=
windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>welcome</TITLE>
<META NAME="Version" CONTENT="8.0.3326">
<META NAME="Date" CONTENT="9/26/96">
<META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT
OFFICE\OFFICE\HTML.DOT">
</HEAD>
I really wonder about all this <meta>
content. Is it required, no. Does it provide any useful information for the page user, no.
I did initially think the date may be informative but then realised, no. Would
CONTENT="10/2/96" equal the 10th of February or the 2nd of October? and in any
event is it the date the page was written or the date of the software?
What is missing and is required is the document
type declaration.
I am currently researching this question in
relation to what <!doctype> should one use on pages that do not validate to a
standard. The absence of a <!doctype> now implies one at html level 2.0. Whilst the
presence or otherwise of a <!doctype> has no apparent significant effect the
standard does require one and it could be important in future versions of browsers and
other user agents.
Now to the body of the document:
<BODY TEXT="#000000"
LINK="#0000ff" VLINK="#800080" BGCOLOR=
"#000000">
Whilst this follows the recommendation that if
you set one colour you should set them all, it sets colours that contradict the very
purpose of that recommendation by setting the background to "#000000" (black)
and the text to "#000000" (black).
As the only text on the page has its colour set
to dark blue by an attribute to the <font> tag then why not set the set the
<body> text to "#000080" (dark blue). That way browsers that don't support
<font color=> at least might get to see the text in dark blue.
<FONT SIZE=2><P> </P>
</FONT><P> </P>
<P> </P>
Three paragraphs each containing a non-breaking
page space ( ). They are used in this situation to put some "white
space" at the start of the document but why set the font size on the first 'empty'
paragraph? The difference between <p><font
size=2> </font></p> and <p> </p> is VERY
small in terms of positioning the subsequent content.
This line also introduces some invalid code. The
block level element <p> can contain a text level element like <font>, NOT the
other way around.
Users of these types of constructions should
also be aware that some older browsers do not support the named entity reference for a
non-breaking space of It is therefore slightly "safer" to use the
numeric character reference alternative of   Seeing " "
literally printed does look ugly on those browsers.
<P ALIGN="CENTER"><A
HREF="main.html"><IMG SRC="IMAGES03.JPG"
BORDER=0 WIDTH=77 HEIGHT=161></A></P>
Adding the ALT= attribute (and some appropriate
content) to the <IMG> element would provide some meaningful content for those
browsing with 'images off' or using a text only browser. This is becoming even more
important as a relatively high proportion of web users now "surf" with images
off. I've seen estimates of 20 to 30%.
<B><FONT SIZE=4
COLOR="#000080"><P ALIGN="CENTER">Click to
enter</P>
Again, some more invalid code. The <P>
block level element closes the text level <B> and <FONT> elements before their
ending </B> and </FONT> tags.
Some also hold that "Click to..." is
bad style. A person browsing with a keyboard does not "Click" and a blind person
browsing using a speaking browser does not "Click". An alternative term such as
"Select" comes to mind.
</FONT><FONT
COLOR="#000080"><P
ALIGN="CENTER"> </P></B></FONT></BODY>
</HTML>
This closing section of the page code is the
part I was especially thinking of when I used the phrase "dogs breakfast".
Leaving aside the coding sequence errors why set
up a paragraph containing a space, add code to colour it, add extra code to centre it when
you can't see a space anyway, and all at the end of the page with no subsequent content?
In summary the page could have been written in a
valid manner, producing the same result to a wider range of browsers and with 47% less
bytes as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
3.2//EN">
<HTML>
<HEAD><TITLE>welcome</TITLE></HEAD>
<BODY TEXT="#000080" LINK="#0000ff" VLINK="#800080"
BGCOLOR="#000000">
<P> 
<P> 
<P> 
<P ALIGN=CENTER><A HREF="main.html">
<IMG SRC="IMAGES03.JPG" BORDER=0 WIDTH=77 HEIGHT=161
ALT="Select to enter"></A>
<P ALIGN=CENTER><BIG><B>Select to enter</B></BIG>
</BODY>
</HTML>
|