There is a variety of HTML that you can just leave out of the source HTML and it’s still valid markup.
Doesn’t this look weird?
Paragraph one.
Paragraph two.
Paragraph three.
It does to me, but the closing
tags are optional. The browser will detect it needs them and manifest correctly in the DOM anyway.
This probably happens to HTML you write and you don’t even know it. For example…
That looks perfectly fine to me, but the browser will inject a
in there around that
for you. Optional in HTML, but the DOM will put it in anyway.
Heck, you don’t really even need a in the same fashion! Jens Oliver Meiert shares more:
Some attributes are “optional” too in the sense that they have defaults you can leave out. For example, a