HTML (or XHTML) has some inherent difficulties in creating well formed documents. While XHTML has been written to XML specifications, many browsers do not understand HTML that has been written to be well formed.
Many tags do not have matching end tags, such as <dt> and <li>. These tags need an end tag. Most browsers will not have difficulties with this. So be sure to use them.
There are several tags in HTML that are singleton tags. For these tags, you need to add a trailing slash in the tag. However, you must make sure to put a space after the tag name and any attributes, as many browsers will get confused by the final slash. For example <br /> and not <br/>.
One of the most common errors to well formed HTML is unquoted attributes. This is important to do because browsers can get confused between different attributes. But it's a good habit to get into and will keep your documents well formed.
Make sure that all <, >, and & characters are escaped. This means you should use the character codes <, > and & in your HTML.
Always enclose your entire HTML document in the <html></html> tag.
Follow these rules and your HTML will be well formed, and you'll be on your way to learning and using XML.