RE: Style tag not validated correctly for HTML 4.01

On Wed, 2003-10-29 at 07:40, Gavin Lambert wrote:

> Side note, I thought XML syntax is fine for HTML 4,

Depends on the definition of "fine" :)  Anyway, it may validate but will
most likely not be what you mean.  Experiment with the validator's "show
parse tree" option.  Hint: for "<br />" in HTML, the br element ends at
the "/".

> so long as you include a space, as "<br />".

The space has nothing to do with validity.  In *XHTML* (not HTML, see
above), using it may produce "better" results when viewed with a user
agent that groks HTML but not XHTML: http://www.w3.org/TR/xhtml1/#C_2

>    1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>    2: <html>
>    3: <head>
>    4:   <title>Pueblo/UE News</title>
>    5: <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
>    6:   <basefont face="Verdana,Arial,Helvetica" size=2>
>    7:   <style type="text/css">
[...]

The culprit is the basefont element which is not allowed in HEAD and
thus implicitly closes it and begins the BODY.  See the parse tree at
http://validator.w3.org/check?uri=http%3A%2F%2Fpueblo.sf.net%2F&doctype=HTML+4.01+Transitional&ss=1&sp=1#parse

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