untitled

(John Hannent) #1
Now follow these steps to validate this HTML code:


  1. Open this HTML validation page at
    http://validator.w3.org/

  2. Find the section on that Web page titled Validate by File Upload.

  3. Click the Browse button on the Web page.
    A Choose File dialog box opens.

  4. Navigate to locate your file at c:\myfirst.htm.

  5. Double-click c:\myfirst.htm in the dialog box.


The dialog box closes. Your file’s address is now displayed in the Local
File text box on the Web page.


  1. Click the Check button on the Web page.


You then see a report on the errors in, and warnings about, your HTML
code.

The debugger might complain that you’re sending ordinary text (text/plain)
and it doesn’t support plain text. Whatever. If you’re determined to use this
debugger, you can fiddle around with IIS or IE to try to specify a text/html
MIME Content-Type value. Getting into all this is beyond the scope of this
book. I tried using IE in a different computer and the W3C site accepted that
.html file and parsed it.

Here’s a shortcut: Try downloading Mozilla Firefox. It’s free and the W3C
debugger seems to find it more congenial. So if you experience problems
using IE to send files to the validator, try Firefox.

Using Firefox, I managed to get a report from the debugger. It said that char-
acter encoding was missing (it almost always seems to say that) and that my
page was not valid HTML 4.01 transitional (it almost always seems to say
that, too).

As for errors in my code, the validator said that line 7 (<style>) needed a
typeto be specified (the typeattribute is required, it said). It also com-
plained about a missing end tag in line 13 for the headelement, even though
a </head>end tag ispresent. I assume that this is likely to be a side-effect
because of the problem it sees with the <style>element. Browsers seem to
have no problems with this simple HTML page, but the validator did. I tried
providing the typeattribute that it requested:

<style type=”text/css”>

312 Part IV: Advanced CSS Techniques

Free download pdf