How to close <img> tag properly?
<img src='stackoverflow.png' />
Works fine and closes the tag properly. Best to add the alt
attribute for people that are visually impaired.
This one is valid HTML5 and it is absolutely fine without closing it. It is a so-called void element:
<img src='stackoverflow.png'>
The following are valid XHTML tags. They have to be closed. The later one is also fine in HTML 5:
<img src='stackoverflow.png'></img>
<img src='stackoverflow.png' />