Close HTML Script Tag [duplicate]

The concept of self-closing tags is an XML concept. You can’t use them in HTML. (You can use them in XHTML, but only if the document is served with an XML content-type, not if it is served as text/html).

In HTML some elements (such as <img>) cannot have any content, so they don’t have end tags).

Since a script can have a src attribute or the script be can inside the element, <script> is not one of them.

(HTML 5 allows a / character to appear at the end of a start tag for an element that is defined as EMPTY, but it is just sugar for people addicted to XML and has no meaning in the language).

Leave a Comment

tech