W3C home > Mailing lists > Public > www-validator@w3.org > August 2002

Re: HTML Validator... Problem?

From: Liam Quinn <liam@htmlhelp.com>
Date: Fri, 16 Aug 2002 22:59:37 -0400 (EDT)
To: David Newberry <davidnewberry@mac.com>
cc: <www-validator@w3.org>
Message-ID: <Pine.LNX.4.33L2.0208162255360.1077-100000@localhost.localdomain>

On Fri, 16 Aug 2002, David Newberry wrote:

> Anyway, this is the message it's reporting:
>
>     <p align="center"><hr width="65%" noshade size="1" color="000000"></p>
>                                                                         ^
>     Error: end tag for element "P" which is not open; try removing the end
> tag or check for improper nesting of elements
>
> Now, call me crazy, but it looks very definitely like I can close that P
> tag. When I look at the source tree, I see that it reports this:
>
>    <P>
>    </P>
>    <HR>
>    </HR>
>
> It seems that the validator is a little too eager and closes the P tag on
> its own before it gives me a chance. Am I correct that this is a bug, or
> did I do something stupid?

P cannot contain block-level elements such as HR.  Since the ending tag
for P is optional, the <HR> tag implies the end of the P.

If you wish to specify the alignment of an HR element, you can use <hr
align="center"> in HTML 4 Transitional.  However, the "align" attribute is
deprecated in favour of style sheets.  I generally find my HTML to be
nicer and easier to maintain if I don't use HR elements at all and instead
specify border-top or border-bottom in a Cascading Style Sheet.

-- 
Liam Quinn
Received on Friday, 16 August 2002 22:59:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:03 GMT