Introduction to HTML

← Forum
148 pts


Is the closing "/" necessary in tags that close themselves (like the image tag)?

<img src="" />

I've tried using this code without a closing slash and it's worked just fine. I've never learned to use a slash here; is this necessary?

  • 3114 pts

    Alex J

    0 votes

    It's only necessary if you want your HTML to be XHTML-compliant – if you don't know what that is, you probably shouldn't bother. Browsers won't care.