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
Alex
source share3 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
Sarfraz
source shareNot. What are all valid self-closing elements in XHTML (as implemented by major browsers)?
+3
ghoppe
source shareThere 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
jessegavin
source share