I’ve read that <img></img> (is illegal);
I’ve read that /> is optional and it’s only there for “transitional policies”.
Can this be a correct syntax for img element?
<img src="/somepath" alt="required foo">
I’m asking this because Netbeans 7.0.1 detects that has an error and made me wondering.
It does the same for other void elements like: <br>
It would be a correct syntax if
srcwasn’t empty!As the question has been edited, yes, it’s a correct syntax for HTML5.
EDIT: but you can explicitly close your element too
http://dev.w3.org/html5/html-author/#elements