HTML and CSS Reference
In-Depth Information
figure 9-16
Results of the validation test under XHtML 1.0 transitional
6. Scroll down the Web page to read the validator's summary of the errors.
The validator reports a total of nine errors. This doesn't mean that there are nine sepa-
rate mistakes in the file. In some cases, the same mistake results in several errors being
noted in the report; and fixing one mistake can result in several of the errors reported
by the validator being resolved. In a large error list, it's unlikely that you can fix every-
thing at once. It's best to fix the most obvious mistakes first to reduce the size of the list,
leaving the more subtle errors to be fixed last. Tom wants you to examine the error list in
more detail. The first error reported was the following:
Line 31, column 62 : end tag for “img” omitted, but OMittAG nO was specified
ƒƒƒƒƒƒ<imgƒsrc=”logo.jpg”ƒalt=”WizardƒWorks”ƒalign=”left” >
When the validator reports that the end tag for an element is missing, it means that
either a two-sided tag is missing an end tag, or a one-sided tag was improperly entered.
This is a syntax error and indicates that the document is not well formed. If you examine
the code for the logo.jpg inline image, you'll notice that the img element was not writ-
ten as a one-sided tag. This is a common problem with older HTML code, in which tags
for empty elements use the same form as the opening tags of two-sided tags. Note that
even though the tag was improperly entered, the page was still rendered correctly by the
browser earlier in the tutorial. This is because browsers usually can render a Web page
even when it violates XHTML syntax.
Another error reported by the validator indicates a problem with the document's validity:
Line 55, column 47 : required attribute “alt” not specified
The exact line number
and column number
might differ depending
on how you entered text
into the document.
ƒƒƒƒƒƒ<imgƒsrc=”firework.gif”ƒalign=”right” >
This is an inline image without the alt attribute. Because the alt attribute is required
for all inline images within an XHTML document, omitting it results in an error. This
inline image was also not inserted using a one-sided tag, resulting in a second syntax
error. You'll fix these errors and resubmit the file for testing.
To fix and resubmit the file:
1. Return to the works.htm file in your text editor.
2. Locate the img element for the logo.jpg file, and then change it to a one-sided tag
using the proper syntax.
 
Search WWH ::




Custom Search