XHTML Formatting – closing tags
Close those elements
When you’re creating valid xHTML you’ll need to make sure that you always close your elements properly. When your element has some data in it make sure you add an end tag directly after your data. Consider the following examples:
<p>This paragraph is perfect</p>
<p>This paragraph is hideous
The first paragraph is properly closed but the second paragraph has omitted the end tag.
There are a couple elements, however, that have to be closed in a special way. These elements do not have any data associated with them and are considered empty, namely the line break, horizontal rule, and image elements.
Don’t do this:
<img src=“cow.jpg†alt=“A picture of a cowâ€>
Do this instead
<img src=“cow.jpg†alt=“A picture of a cow†/>
And you will need to include that space at the end as well-seriously; it is part of the specification.
Here is how the other two elements would look:
<br />
<hr />









