Re: Possible issue with 4.01 strict validator?

Char-Lez Braden wrote:
> Hello,
> I am seeing some behavior I cannot explain that might be a problem with 
> the validator.
> This URL shows a very small HTML 
> document that the validator says is good, but looks I believe the HTML 
> is missing a </p> tag (Right above the </body> tag).   When I put the 
> <p> tag in ( I get the message 
> "Error  Line 19 column 7: end tag for element "P" which is not open."
> When I look at the parse tree (demo.html) it appears to me that the 
> validator is inserting a </p> just before the <ul> tag.
What you are missing is that the <ul> element is a Block element, and 
the <p> element (also a Block element) cannot contain another block element.

The xhtml version of this would be:
     <p>yack yack yack</p>
     <p>blah blah blah</p>
     <p></p> <!-- could also do <p /> -->
         <li><a href=''>item 1</a></li>
         <li><a href=''>item 2</a></li>
(I've squished things to make the message smaller)

Because html 4.01 defines closing tags as optional for <p>, the opening 
<ul> implies the closing </p>, therefor putting the </p> after the </ul> 
closes a <p> that is, in fact, already closed.

Hope this helps.


Ian Stuart.
Bibliographics and Multimedia Service Delivery team,
The University of Edinburgh.

Received on Tuesday, 30 August 2005 13:21:30 UTC