Lab #4 XHTML and CSS

(due Tuesday, 1/27, 11:59 PM)

Validating XHTML


1. Recall from lecture that the XHTML standard is just HTML with a few extra rules. For example, all tags must be in lowercase, closed, and nested properly. Additionally, the top three lines of the file tell web browsers that the XHTML standard is being used. In HTML, the top line was <html>. In XHTML, that line is replaced with the three bold lines seen below:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>

  <body>

  </body>

</html>

2. Copy the template above and start making a web page. You will not be submitting this web page, but you will use this page to get practice validating XHTML pages, so try to add a lot of stuff to the page. You should use all the tags from Lab #3 along with images and links. Save the file as lab4.html (XHTML files are still saved with a .html file extension).

3. To validate your page, go to http://validator.w3.org/. You have 3 options. The first option ("by URI") works if you uploaded your file to your web space on Dante/Homer. The second option ("by File Upload") will work if you just want to validate a file on your computer before uploading it to your web space. The third option ("by Direct Input") works by copying the text of your file and pasting it in the text box provided by the validation web site. Take your pick. I suggest trying all three at one point and seeing which way you prefer.

Note: URI is a general term that includes URLs.

4. If your page returns no errors, then you are done validating (but continue reading the rest of this page for information about reference pages). Otherwise, scroll down the validation page and look at the first error. If you don't understand what it is saying, ask a neighbor or a TA. Once you understand what the error message is telling you, fix the error in the original XHTML file. For example, if you are using the "by Direct Input" method and you fix the problem in the text box, you might get it to validate, but your original file on your computer or on Dante/Homer will NOT be fixed! Continue revalidating until your page passes!

The "XHTML 1.0 Strict" Reference will be useful. Remember that the body element only allows block-level elements (see "Content" row). Make sure you understand how to read and use the reference pages for XHTML elements. There's a lot of information, but other than "Attributes", you should have a general understanding of all the sections in the reference pages of XHTML elements. If you don't, make sure to ask!

previous page   next page