Forum Moderators: open
I am using the option tag a lot on a site. I noticed that I could reduce about 3% of a project's bandwidth by nixing the close option tag. Is it considered okay to close the option tag inline.
This is what I would like to do
<option value="1" />One
<option value="2" />Two
<option value="3" />Three This is what I currently do:
<option value="1" />One</option>
<option value="2" />Two</option>
<option value="3" />Three</option> I tested the idea on different browsers and it displayed okay.
<option value="1" />One</option>
The trailing slash in the above example is incorrect because it would close the
option element before the contents. You can't rely on using XML syntax unless you are using XHTML served as XML rather than HTML, and in that case your page wouldn't work in Internet Explorer.
You have two options: either to use the syntax
<option value="1">One</option> and continue using an XHTML doctype, or you can switch to HTML 4.01 Transitional (as XHTML as HTML offers no advantages) and drop the closing tag.