I read several style guides and saw conflicting recommendations regarding optional tags.
Google says:
Omit optional tags (optional). To optimize file size and for tracking purposes, consider excluding additional tags. The HTML5 specification defines which tags may be omitted.
(This approach may require establishing a grace period as wider since it differs significantly from what web developers usually teach. For convenience and simplicity, it has canceled all optional tags, not just the choice.)
W3CSchools says:
Close all HTML elements In HTML5, you do not need to close all elements (for example, an element <p>).
We recommend that you close all HTML elements:
and
We do not recommend excluding <html> and <body>.
This means that Google prefers:
<!DOCTYPE html>
<title>Saving money, saving bytes</title>
<p>Qed.
W3CSchools prefers:
<!DOCTYPE html>
<html>
<title>Page Title</title>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
also considered "bad looking" to write this, whereas Google would recommend it.
<section>
<p>This is a paragraph.
<p>This is a paragraph.
</section>
I was very interested in what W3CSchools matters with regard to the title tag
Is there any good reason to stop using optional tags? Personally, I found the code less readable, but it is purely opinion-based, and I think that with some preparation I would prefer one over the other.
Google , , ? , , ,
: