Validating an XHTML/HTML Page

What is Validation?

The method that used to verify that the tags used in your HTML file conforms to a defined Document Type Definition, or DTD.

Validating a HTML/XHTML page is not strictly necessary, but can be most helpful to two reasons:

  1. Validation can help you to check for errors that current browsers normally forgive, so that you know your pages are correct before you turn them in for a grade.
  2. There are times when a page just doesn't look right, and can't figure out why. Attempting to validate the page can show you where you may have a mispelled or misplaced tag.

How To Validate

  1. We have to specify the DTD that we're going to follow. That is done thrugh a special tag called the "DOCTYPE declaration." The DOCTYPE declaration is what links a document to the DTD to which it need to conform.
  2. The line, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    is placed at the beginning of each HTML file that you create.
  3. Open your browser to the following link, http://validator.w3.org/file-upload.html
  4. Select browse to locate your file and click open.
  5. Click the Validate This File Button.

An example file:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<HTML>

<HEAD>
<TITLE>Test Page</TITLE>
</HEAD>

<BODY>
Hello, World!
</BODY>

</HTML>

When should the Validate line & browser page be used?

Each time you are given an assignment, the validation tag should be added and validation page should be used.

How Will Ms. Gibson know?

I will know that is has been used, because you will have corrected most of your own mistakes before turning in your assignments. This will aid in assisting you in attention to details.