Back to main page!

Knowledgebase Home Knowledgebase Home
Search the Knowledgebase Browse by Category
Why do some elements end with /> in XHTML pages?
User Opinions
No users have voted.

How would you rate this answer?
Helpful
Not helpful
Every XHTML element has to be closed so that the parser doesn't have to have special knowledge of each element in order to properly parse it. For instance, before XHTML, a naive parser might have thought that:

<br>

Meant that a br "block" had been opened, and that parser might wait around for a closing:

</br>

Which would never appear.

Another good example of an "empty" element that needs a trailing slash to be XHTML compliant is the <img /> element. Elements that do have a closing element, such as <body>...</body>, should not have a / before the >.

Visitor Comments
No visitor comments posted. Post a comment
Related Questions
Attachments
No attachments were found.

Home | Web Design | Print Advertisements | Banner Design | Other Services


Copyright © 2003 Digital Arts Group @ FrankGonzalez.com. All Rights Reserved
About Us | Disclaimer | Privacy Policy | Terms of Use | Design Team | Sitemap