Possible Duplicate:
Can a span be closed using <span />?
<p>This is a test <span id='span1' style='display:inline-block;'></span> to see if I can embed an inline block.</p>
<p>This is a test <span id='span2' style='display:inline-block;'/> to see if I can embed an inline block.</p>
The first line embeds a span with a regular closing tag, while the second uses a self-closing tag. The first line works properly, while the second has a bizarre result.
I'm just curious why there is such a difference in the handling of the element in each case. I'm aware that under non-strict xhtml, self-closing tags aren't very well supported. It appears the self-closing tag is being treated as just an open tag.
Is there a good reason modern browsers still don't support self-closing html tags? Am I expected to change the doctype or something to get this to work?
The irony is I actually started with an explicit closing tag, but ran it through the browser's xml parser and back to html, and the parser felt like collapsing the empty element into a self-closing tag, which promptly broke everything.