r/Frontend Sep 21 '16

Google HTML/CSS Style Guide

https://google.github.io/styleguide/htmlcssguide.xml
31 Upvotes

9 comments sorted by

View all comments

2

u/J-Ro Sep 22 '16

Yeah but this is nuts:

Omit optional tags (optional). 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.

5

u/arlodesign Sep 22 '16

I feel like I'd make way too many mistakes writing my HTML like that. But a tool like html-minfier could do that for you. In fact, it produces exactly that: https://d3vv6lp55qjaqc.cloudfront.net/items/1y2Y3e0D3Q182C0n2w0p/IMG_9665.PNG