Re: Valid HTML 4.01? need explanation!

On Sun, 1 Sep 2002, Herbert Poetzl wrote:

> the following html code puzzles me, because
> I am unable to explain the behaviour of the
> validation service at w3c.
[...]
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> <HTML>
>   <HEAD>
>     <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
>     <TITLE>Good HTML</TITLE>
>   </HEAD>
>   <BODY>
>     <TABLE width="100%">
>       <TR>
>         <TD>
>           <FORM method="post" action="/someurl.html">
>
>             <P> <!-- required for validation -->
>
> 	      <INPUT type="hidden" name="user" value="hans">

In HTML 4 Strict, FORM can contain only block-level elements (and SCRIPT).
So you need to put inline elements such as INPUT in a block-level element
like P.

> 	      <TABLE>
> 	        <TR>
> 		  <TD>
> 		    xxx
> 		  </TD>
> 		</TR>
> 	      </TABLE>
>
> 	    </P> <!-- not allowed for validation -->

P can only contain inline elements while TABLE is a block-level element.
Since the ending tag for P is optional in HTML, the TABLE start-tag
implies the end of the P element.

-- 
Liam Quinn

Received on Sunday, 1 September 2002 22:24:24 UTC