Click to See Complete Forum and Search --> : XHTML Empty/Not Empty elements
Mr Initial Man
04-09-2007, 08:43 PM
One thing about XML is that, by closing a start tag, you can effectively render any element "empty".
Would you guys agree that the only element that option will be commonly applied to is the <script> element, depending on whether you have an outside file or an internal script?
NogDog
04-10-2007, 02:19 AM
How about <a name="anchor" />?
Mr Initial Man
04-10-2007, 08:50 AM
I don't really see that being used all that often by serious webdevelopers. In my humble opinion, that's something of a hack anyways. If you wanna do things that way, you could always go by the id attribute of an element.
NogDog
04-10-2007, 08:35 PM
Why is it a hack? It's precisely what the HTML spec defines as one of the two uses of the <a> tag (http://www.w3.org/TR/html4/struct/links.html#edef-A). Whether you personally do not like to use it (or the fact that I don't normally use it that way any more, either), does not make it a "hack".
boxxertrumps
04-10-2007, 09:45 PM
<kidding>
Hack? Your The hack!
</kidding>
<hr /> <br /> <option /> <meta /> <link /> <script src="" />
Any others that don't need to contain text?
Mr Initial Man
04-10-2007, 09:57 PM
Hmmm... That I hadn't known. But still, I think <script> will be the only element that commonly uses that option.
boxxertrumps
04-10-2007, 10:11 PM
in XML, you have to close all your tags.
(it's better haveing breaks and horizontal lines with shorttags, less code.)
Mr Initial Man
04-10-2007, 10:52 PM
I was replying to NogDog there.
What you have to keep in mind was that my original post was about elements that could be EITHER empty or non-empty. <hr />, <br />, <option />, <meta />, and <link /> are inherently empty according to HTML. <script /> isn't.