Using XHTML slash (/) for regular tags?

I'm just wondering if it's acceptable to close a common tag, for example. a <span> that does not require data using an XHTML slash to reduce markup.

So for example:

 <span id='hello'></span> 

can be written as

 <span id='hello' /> 
+2
source share
3 answers

No, you cannot do this, span not a self-closing tag . Here are the tags that close the tags:

 <area /> <base /> <basefont /> <br /> <hr /> <input /> <img /> <link /> <meta /> 
+3
source

There are empty or self-closing tags. Span is not one of them.

http://justinsomnia.org/2005/12/there-are-only-10-legal-xhtml-empty-tags/

+3
source

Source: https://habr.com/ru/post/1414956/


All Articles