Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Probably you know this, but you don't actually need to close every <p> with a </p>.


I've been through enough different HTML variants whilst not having to adhere strictly to standards that I'm moderately fuzzy what the current state of the standard is. I hear the current standard is also ... large.[1]

But even if it's not strictly necessary to balance <p> tags ... it is necessary to do so with many other HTML elements, and missing or mis-typed tags can utterly bork a page, particularly if there's any complexity to it.

(Hand-crafting tends to minimise that complexity, but it's still possible to get reasonably twisted.)

That said, checking one of my favourite HTML5 references, whose page source itself is a beautiful example of clean HTML ... I see that Mark Pilgrim in fact omits the close tags on his paragraphs:

<view-source:http://diveintohtml5.info/introduction.html>

And that said: LaTeX and Markdown also omit the need for the opening paragraph tag. So there's that.

Still, fair point ;-)

________________________________

Notes:

1. Drew DeVault has suggested as much: <https://drewdevault.com/2020/03/18/Reckless-limitless-scope....>




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: