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

Re: [VE] [79] Horizontal Rule <hr> Tags Break Paragraphs

From: David Dorward <david@dorward.me.uk>
Date: Sat, 16 Aug 2014 23:29:34 +0100
To: "Pluto is a Planet" <d_2100@hotmail.com>
Cc: "www-validator@w3.org" <www-validator@w3.org>
Message-ID: <7E7AD376-50FE-41BE-9431-19F31BE97078@dorward.me.uk>
On 16 Aug 2014, at 0:57, Pluto is a Planet wrote:

> While the reference states that any flow elements are permitted as 
> parents (including the p tag), the hr tag breaks a paragraph it’s 
> contained in so that it’s considered the end tag of a p tag. If you 
> do have a closing /p tag or text content after an hr tag, it’ll be 
> considered an error.

I don't know what reference you are looking at, but the specification 

> 4.4.2 The hr element
> **Categories:**<br>
> Flow content.
> **Contexts in which this element can be used:**<br>
> Where flow content is expected.


> 4.4.1 The p element
> …
> **Content model:**<br>
> Phrasing content.

Since the p element can contain only *phrasing* content, the hr element 
is not permitted inside (since it is allowed only where *flow* content 
is allowed).

> One of the details mentioned with this error is that it can be caused 
> “by an implicitly closed element (if you have an error related to an 
> element being used where it is not allowed, this is almost certainly 
> the case),” which seems to make sense, except there is no error in 
> validating the hr tag (nor should there be based on the 
> specification).

The end tag for the p element is optional.

Since the hr element is not allowed inside the p element, the hr start 
tag also ends the p element.

The p end tag therefore doesn't have an open p element to close.

David Dorward
Received on Saturday, 16 August 2014 22:29:59 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:11 UTC