logoalt Hacker News

vbezhenaryesterday at 10:14 AM4 repliesview on HN

Closing optional HTML tags just adds more ambiguity. How many HTMLParagraphElements here, what do you think?

    <p>
      text1
      <p>
        text2
      </p>
    </p>

Replies

hnlmorgyesterday at 10:21 AM

2. And there’s no ambiguity there, just invalid HTML because paragraphs aren’t nestable.

show 3 replies
have_faithyesterday at 10:18 AM

Why would you nest paragraph tags?

show 1 reply
b2ccb2yesterday at 10:24 AM

That is invalid syntax. Only phrasing content is allowed the p element (https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Con...)

show 1 reply
psychoslaveyesterday at 10:45 AM

This is invalid html, p tag can be nested in a p tag.

show 1 reply