No. In XHTML, you are required to close your p and li tags. In HTML, the "self-closing" tag is meaningless. That slash doesn't do anything. You can't self-close a <script> or <div> tag. It only appears to work for tags that are don't allow closing.
In HTML, you can add the slash, but it has no effect. The spec explicitly says that the slash does not close the element. The fact that it's "br" does. So you are allowed to add that slash. But adding it does not close the element.
> On void elements, it does not mark the start tag as self-closing but instead is unnecessary and has no effect of any kind.
No. In XHTML, you are required to close your p and li tags. In HTML, the "self-closing" tag is meaningless. That slash doesn't do anything. You can't self-close a <script> or <div> tag. It only appears to work for tags that are don't allow closing.
We aren’t talking about p and li tags which require data to be embedded.
We are talking about self-contained tags such as br.
In XHTML (and XML in general) tags absolutely can be open and closed inside the same tag via the method I described:
Look it up if you don’t believe me. But this is correct.
Are we talking about HTML or XHTML?
In HTML, you can add the slash, but it has no effect. The spec explicitly says that the slash does not close the element. The fact that it's "br" does. So you are allowed to add that slash. But adding it does not close the element.
> On void elements, it does not mark the start tag as self-closing but instead is unnecessary and has no effect of any kind.
https://html.spec.whatwg.org/multipage/syntax.html#start-tag...
In XHTML, normal XML rules apply, as you say. That's consistent with what I've said earlier in this thread also.
2 replies →