Re: closing slash at the end of the base HTML tag leads to an error

> 
> I need to be conform both with HTML4.01 and XHTML.

It isn't possible to have a document that's both valid XHTML and
HTML4[1]. You could make both a XHTML and HTML4 version of the same 
document and serve the appropriate version to different browsers.

> The base element does not allow the closing tag at the end in HTML but 
> requires it in XHTML.

That's since in XHTML every tag needs to be closed.

> <base href="xyz" /> <!-- this is correct in XHTML but wrong in
HTML4.01
> <base href="xyz">   <!-- wrong in XHTML, but wrong in HTML4.01

I think you mean right in HTML4.01 for the latter part of the second
example. The example with /> is invalid HTML since that results in a 
greater than sign being inside the head element, and character data 
can't go there.

> In HTML specification the closing tag for br element is forbidden as 
> well, but according to the validator <br /> is a right HTML.

<br /> is valid HTML, but it doesn't mean what you'd expect. It means a 
br tag followed by a greater than sign. If you validate with the parse
tree option you should be able to get a clearer picture of what's going
on.



[1]: There might be some cases for very simple pages, but nothing
practical

Received on Friday, 28 January 2005 03:59:49 UTC