RE: Style tag not validated correctly for HTML 4.01

On Wed, 29 Oct 2003, Gavin Lambert wrote:

> I know there are several problems with the HTML on this page, but still,
> what I reported still seemed accurate....

It's generally better to fix your markup errors than to speculate on
errors in a validator.

> Side note, I thought XML syntax is fine for HTML 4, so long as you
> include a space, as "<br />".

That's a popular superstition, largely propagated through misleading
formulations in specifications and errors in virtually all browsers, but
it still isn't true, as far as specifications (including DTDs) go.
Explained in detail at
http://www.cs.tut.fi/~jkorpela/html/empty.html

>  I don't think I used any in this document, though.

That is correct, and we would have seen that at once if you had
posted the URL in the original question. After all, those slashes
_are_ the most common reason for this type of error message.

>    6:   <basefont face="Verdana,Arial,Helvetica" size=2>

This tag (which, by the way, should not be used at all) is only allowed
inside the body element, by the DTD. Hence, it implicitly closes the
head part and starts the body element. In other words, it implies
</head><body> before it. Thus, anything that may only appear in a head
element, such as a style element, becomes now invalid.

If you use a basefont element, you thus need to move it into the body
element. But since it causes damage, it is best to remove it.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Wednesday, 29 October 2003 02:30:12 UTC