January 26, 2024 - Reading time: ~1 minute

I may have been stuck in xml model or several years ago but in the Uni course I learned that a HTML5 document doesn't validate if you close self-closing elements. You should write <img src="" alt="">, <br>, <hr> etc. and not <br/> and so on.

Here's the W3C HTML5 validator: https://validator.w3.org/nu/#textarea. You can also add an extension to your code editor.

Also, the closing tag may be omitted if a block element follows, for instance:

<p>Some text added
<li>item 1</li>
<li>item 2</li>

is valid.

Confusing, eh!