Re: Wrong validation of <p> tag?

Maurizio Paglia (mpaglia0@gmail.com) wrote:

>
> the validator returns this error:
>
> Error: No p element in scope but a p end tag seen.
> From line 132, column 17; to line 132, column 20
>           </p>↩
>
> The error report is correct


> On this piece of code:
>
>                 <p class="article-summary">↩
>                      <p>Oggi scrivo qualcosa relativo ad un argomento per
> il
>
> By HTML rules, <p> elements cannot be nested. A <p> element is a paragraph
in the sense of containing just text and text-level markup.

What happens here is that that the second <p> element implicitly closes the
previous open <p> element and thereby starts a new paragraph after it,
inside it. So far the markup is formally correct, but when the end tag </p>
that is meant the end the element started by <p class="article-summary"> is
encountered, it is an error, a homeless end tag.

To fix this, replace <p class="article-summary"> by a tag for a block
element that may contain paragraphs, such as <div> or <section>, and of
course replace by the </p> tag by the corresponding end tag.

Received on Monday, 27 September 2021 11:28:24 UTC