| Why do some elements end with /> in XHTML pages? |
| User Opinions |
|
No users have voted.
|
|
Thank you for rating this answer.
|
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
|
| Attachments |
|
No attachments were found.
|