
Ask HN: Why does Google 404 serve invalid HTML? - philip1209
e.x. http:&#x2F;&#x2F;google.com&#x2F;notfound<p>The &quot;html&quot; tag is not closed. &quot;body&quot; does not exist. CSS refers to elements that do not exist.<p>Are they minifying to the extreme and relying on the browser to add &lt;body&gt; and close the HTML?
======
zephyr39
The Google Style Guide[0] for HTML recommends omitting all optional tags. That
includes <html>, <head>, <body>, <p> and <li>.

[0]
[https://google.github.io/styleguide/htmlcssguide.xml#Optiona...](https://google.github.io/styleguide/htmlcssguide.xml#Optional_Tags)

 _For file size optimization and scannability purposes, consider omitting
optional tags. The HTML5 specification defines what tags can be omitted._

 _(This approach may require a grace period to be established as a wider
guideline as it’s significantly different from what web developers are
typically taught. For consistency and simplicity reasons it’s best served
omitting all optional tags, not just a selection.)_

    
    
      <!-- Not recommended -->
      <!DOCTYPE html>
      <html>
        <head>
          <title>Spending money, spending bytes</title>
        </head>
        <body>
          <p>Sic.</p>
        </body>
      </html>
    
      <!-- Recommended -->
      <!DOCTYPE html>
      <title>Saving money, saving bytes</title>
      <p>Qed.

------
xydac
That's interesting to know. A Body css without a <body> tag..!!

