Re: <h1> within <p>

"Richard Caylor" <richardc@transition.com>

> If <h1> is not allowed within <p>, then shouldn't the validator say so
> (when it encounters the <h1>) rather than silently ending the <p> and
> leaving the user to wonder what happened?

The closing P tag is optional though, so even though it's not in your
markup- the validator sees it by the rules of HTML.

<p>
</p>
<h1> ... </h1>
</p>

The validator's message does include
"try removing the end tag or check for improper nesting of elements "
to warn you about the nesting.

The current development validator does give you a link to a page which
says:

"A subtle variation of this is <P><H4>fake font change</H4></P>. <H4>'s
aren't allowed inside <P>'s, but since HTML allows you to omit the </P>
end tag for paragraphs, the validator assumes that you meant
<P></P><H4>fake font change</H4></P>, in which case the final </P> is
indeed superfluous. "

So hopefully it will be less of a problem in future.

Jim.

Received on Thursday, 18 July 2002 13:02:47 UTC