<span class="drop" />
Can HTML spans be closed like this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Whether or not this is valid depends on your doctype, basically whether or not you’re using XHTML or 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/xmlorapplication/xhtml+xml, see here for the details. For pages served astext/html(the vast majority), see here here for the tags that can be self closing.This example will validate:
However, this example is not valid, because I’ve switched the doctype to HTML:
A few helpful references: