This is a good question, only made more difficult to answer if the learner is not familiar with HTML 4.01 or XHTML 1.0 or XHTML 1.1. Those are all three very different languages when we dial into the individual namespaces.
Briefly, in HTML 4 (for short) this was an image element:
<img src="#" alt="">
In XHTML due to its compliance with XML specifications which does not allow ‘void elements’, the compromise made in the recommendations was this,
<img src="#" alt=""/>
as opposed to,
<img src="#" alt=""></img>
which developers were definitely not used to typing.
The recommendation was accepted but then IE5.2 (?) for Mac was crapping out on the syntax. The open source world discovered the hack to fix this, so it was adopted as the recommendation:
<img src="#" alt="" />
And away we went into the world of XHTML development. Most of my past sites are marked up in this language (XHTML 1.0). By the time HTML5 came around I was nearing retirement. I never served XHTML 1.1 which was a much more technical version of 1.0 used largely at the ultra professional level with complex, XML rich environments. We don’t need to go there.
HTML5 recommenders came up with a compromise with respect to HTML 4 and XHTML: Make it comply with both. When served as text/html it follows the recommendation for HTML 4 (with some revision) and when served as text/xml it follows recommendations for XHTML (sans Mac hacks).
So in HTML5,
<img src="#" alt="">
<img src="#" alt=""/>
<img src="#" alt="" />
are all valid. Served as ‘text/html’ the slashes and space-slashes are ignored. Served as ‘text/xml’ the slash is needed, but the space is not, though it is allowed and ignored. If the page is served with no CONTENT-TYPE metadata, it defaults to ‘text/html’ MIME type. HTML5 has a good set of de facto characterizations which was a boon for developers, to be sure. We can leave a lot of stuff out that used to be required, including ‘type’ attributes on ‘.css’ and ‘,js’ requests. among other things.
Bottom line, for our purposes we don’t need the slash. You won’t risk being called lazy if you leave it out and form the habit of NOT using it. For the most part we are writing HTML 4 and so long as our markup is well formed, we are on track to a valid page.
Confusing? Let me know so we can dig a little deeper.