In HTML5 it is possible to accept or not the inclusion/omission of the closing tags in <input>
and in <p>
.
How is it possible and why?
In HTML5 it is possible to accept or not the inclusion/omission of the closing tags in <input>
and in <p>
.
How is it possible and why?
In HTML5 it is possible to accept or not the inclusion/omission of the closing tags in
<input>
and in<p>
.
No. While the end tag for a <p>
element is optional, the end tag for <input>
is forbidden. It must not be included. (Although browsers are pretty good at error recovery).
How is it possible
HTML is designed that way.
Consequently, tools which parse HTML support it.
and why?
It has been that way since the earliest versions of HTML.
I've never seen an explanation for the decision-making process, but some of the benefits include:
as a "paragraph marker".
– BoltClock Oct 20 '18 at 13:08You can dismiss the closing tag almost everywhere, but it is not recommended, code shall not work properly. In some cases, like img, input, meta, link, etc. you don't need to add the closing tag, because you are not inputting any text in between tags (not in all cases).