Whether or not this is valid depends on your doctype, basically whether or not you're using XHTML or HTML.
这是否有效取决于您的doctype,主要是您是否使用XHTML或HTML。
When using XHTML, all major browsers will support self closing tags like the example you provided. Take the following example, this is valid because I'm specifying the page is using XHTML (in other words, HTML that is valid XML).
Update: Based on the very good comments below, browsers will only interpret all self closing tags correctly if the mime type is text/xml or application/xhtml+xml, see here for the details. For pages served as text/html (the vast majority), see here here for the tags that can be self closing.
Testing the following fragment on validator.w3.org:
在validator.w3.org上测试以下片段:
Validating as HTML 4.01 Strict
验证为HTML 4.01严格
# end tag for "SPAN" omitted, but its declaration does not permit this
Validating as XHTML 1.0 Strict
严格地验证XHTML 1.0
# The uploaded document was successfully checked as XHTML 1.0 Strict.
#4
0
Since the tag provides no visual change by itself, it doesn't make sense to me to have an auto-closing span block with no content. The tag provides a way to add a hook to a part of a text or a part of a document. When the text is hooked in a span element you can add styles to the content, or manipulate the content with for example Javascript.
The span tag is useful for hooking css onto a particular segment of text or part of a document. I can't think of any useful/sensible reason that a span tag would self close.
No, it's not. You can close like this ONLY if you can't insert in tag something For example: you can`t insert tag or text inside tag img, so you can close tag like this