Re: Issue with Validator?

Schmitt, Neal (nschmitt@capital.edu) wrote:

I ran this code through the validator and normally the validator would
> catch errors. But the following HTML comes back with no errors. There's no
> body tag and no closing head tag - so there are errors.
>
> <!doctype html>
>

By using <!doctype html>, you request checking against HTML5, whatever that
might mean today. If you served your document with an XML document type,
then the validator would (among other things) check against XML rules,
including the rules for obligatory tags. But apparently you didn’t, so the
validator checked against normal HTML rules, in which the <body> and <head>
tags and their end tags are optional, as they are in all versions of HTML
except those labeled as XML (i.e.. HTML).

In fact, the <head> and <body> (and <html>) tags are optional and useless
in all versions of HTML except those labelled as XML. They are at best
documentary or informative.

Jukka, http://jkorpela.fi

Received on Thursday, 30 September 2021 17:31:31 UTC