Online Book Reader

Home Category

HTML, XHTML and CSS All-In-One for Dummies - Andy Harris [22]

By Root 1312 0

The Oxen and the Wheels

The Oxen and the Wheels

From Aesop’s Fables


Checking the headline repair

The heading tags look a lot better, and a quick check of the validator confirms this fact, as shown in Figure 2-8, which now shows only six errors.

Here’s another form of that document type does not allow error. This one seems strange because surely

tags are allowed in the body! The secret to this particular problem is to look carefully at the error message. This document has a lot of

tags in it. Which one is it complaining about?

A pair of Oxen were drawing a heavily loaded wagon along a

miry country road. They had to use all their strength to pull

the wagon, but they did not complain.

The Wheels of the wagon were of a different sort. Though the

task they had to do was very light compared with that of the

Oxen, they creaked and groaned at every turn. The poor Oxen,

pulling with all their might to draw the wagon through the

deep mud, had their ears filled with the loud complaining of

the Wheels. And this, you may well know, made their work so

much the harder to endure.

Aha! Line 22 is supposed to be the end of the paragraph, but I somehow forgot the slash character, so the validator thinks I’m beginning a new paragraph inside the previous one, which isn’t allowed. This causes a bunch of other errors, too. Because the validator can’t see the end of this paragraph, it thinks that all the rest of the code is inside this first paragraph. Try changing the

of line 22 into a

and see if it works better:

A pair of Oxen were drawing a heavily loaded wagon along a

miry country road. They had to use all their strength to pull

the wagon, but they did not complain.

Figure 2-8: Document type doesn’t allow “p” here. That’s odd.

The complaint is about the

tag on line 22. Unfortunately, Notepad doesn’t have an easy way to know which line you’re on, so you just have to count until I show you some better options in Chapter 3 of this minibook. To make things easier, I’ve reproduced the key part of the code here and highlighted line 22. Try to find the problem before I explain it to you:

The Oxen and the Wheels

From Aesop’s Fables

Figure 2-9 shows the validation results for oxWheels4.html.


Showing off your mad skillz

Sometimes, that green bar makes little tears of joy run down my cheeks. Congratulations! It’s only the second chapter in this minibook, and you’re already writing better Web pages than many professionals.

Seriously, a Web page that validates to XHTML Strict is a big deal, and you deserve to be proud of your efforts. The W3C is so proud of you that they offer you a little badge of honor you can put on your page.

Figure 2-10 shows more of the page you get when your page finally validates correctly. You can see a little button and some crazy-looking HTML code.

Figure 2-9: Hooray! We have a valid page!

Figure 2-10: The validator gives you a little virtual badge of honor to show how cool you are.

If you want, you can copy and paste that code into your page. oxWheels5.html has that special code added at the end of the body, shown in Figure 2-11.

Figure 2-11: Look, I have a medal from the W3C!

Is validation really that big a deal?

I can hear the angry e-mails coming in. “Andy, I’ve been writing Web pages since 1998, and I never used a validator.” Okay, it’s true. A lot of people, even some professional Web developers, work without validating their code. Some of my older Web pages don’t validate at all. (You can run the W3C validator on any page you want, not just one you wrote. This can be a source of great joy if you like feeling superior to sloppy coders.) When I became more proficient and more prolific in my Web development, I found that those little errors often caused a whole lot of grief down the road. I really believe you should validate

Return Main Page Previous Page Next Page

®Online Book Reader