How to close tag properly?

This one is valid HTML5 and it is absolutely fine without closing it. It is a so-called void element:

<img src="https://stackoverflow.com/questions/14860492/stackoverflow.png">

The following are valid XHTML tags. They have to be closed. The later one is also fine in HTML 5:

<img src="https://stackoverflow.com/questions/14860492/stackoverflow.png"></img>
<img src="https://stackoverflow.com/questions/14860492/stackoverflow.png" />

Leave a Comment