How to close <img> tag properly?

The Solution to How to close <img> tag properly? is


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' />

~ Answered on 2013-02-13 18:37:10


Most Viewed Questions: