As per this HTML5 standard: http://www.w3.org/TR/html-markup/syntax.html#void-element
Start tags consist of the following parts, in exactly the following order:
- A "<" character.
- The element’s tag name.
- Optionally, one or more attributes, each of which must be preceded by one or more space characters.
- Optionally, one or more space characters.
- Optionally, a "/" character, which may be present only if the element is a void element.
- A ">" character.
The img
is a void element and hence the part #5 would apply with a caveat that "a '/' character, which may be present..."
And so, you may omit the part #5 i.e. the closing "/", and hence this is also valid:
Further down the spec says:
Void elements only have a start tag; end tags must not be specified for void elements.
So, no end tag is required.