Do you need to have a / at the end of an img tag? I saw an example on W3schools.com without a /:

I know it isn't necessary to self-close the tag, at least in my browser, but should I do so?
Answer
The / is only required for XHTML & XML.
If you're using a HTML5 doctype, then there's no need to terminate self-closing tags in this way.
This applies to , 
, etc.
I.e. Just use , 
and .
If you need an empty element (like a div), don't use , instead use . This is important since in HTML5, the slash is ignored and is interpreted as without a closing tag.
No comments:
Post a Comment