top | item 31700546

(no title)

niconii | 3 years ago

What's not in the spec? Every example in the article is valid HTML, and the article itself, which is written in the same style, is valid as well:

https://validator.w3.org/nu/?doc=https%3A%2F%2Flofi.limo%2Fb...

> Document checking completed. No errors or warnings to show.

Or are you complaining that the rules are too complicated? It's very verbose and explicit because this is a specification, but the basic rule of thumb is that anything that would normally be a block element and thus doesn't make sense inside a paragraph will end that paragraph. In practice, this is not really an issue I run into.

Moreover, you need to know about this rule even if you don't omit </p>, because this is the list of elements that implicitly ends a paragraph. For example, <p><div></div></p> is invalid HTML because <div> ends the paragraph implicitly, making it equivalent to <p></p><div></div></p>.

If you don't like that, then your problem is not with this particular code style but HTML itself, which is reasonable. HTML's syntax is very complicated due to its history and doesn't always make sense. But you still have to know how it works regardless of how you personally like to write it.

discuss

order

moralestapia|3 years ago

Read the quoted sentence again (from the source you brought here), none of those clauses apply to:

<p>

Block of text ...

Which is what they do in the article.

niconii|3 years ago

I don't understand what you mean. Please elaborate.

That quote says that </p> is not needed in many cases. When you say "none of those clauses apply to <p>", this is true, you can't omit <p>, only </p>... but the blog article doesn't advocate for omitting <p> at any point.

anjbe|3 years ago

You misunderstand the spec. Exactly what confuses you is hard to discern, but perhaps you misread “the p element” as referring to the <p> start tag, when in fact the element includes the start tag, text contents, and (if present) the end tag.