I will try to dig up a reference from among the myriad sites I have visited but, from memory, the xhtml rule is simple: any "empty" tag (that doesn't ever have content) may be self-closed. Any tag that MIGHT have content must be explicitly closed. The <a> tag might have content and, in fact, normally has an href="xxxx" element, so it needs a separate closing tag to delineate the operating element (the link). Tags such as <br> or <hr> never have content so they should be: <br /> or <hr />. <p> ALWAYS has content, so needs a </p> to delineate the scope of the paragraph.
|