Google HTML/CSS Style Guide
google-styleguide.googlecode.com
google-styleguide.googlecode.com
IMO, you shouldn't ever drop optional tags for a byte payload reason, this is what minifiers are for (htmlcompressor is extremely robust). But sometimes it makes sense to drop some closing tags so your source isn't an overgrown garden of angle brackets.
It's not only easier, but more readable to do this:
<ul>
<li>Item 1
<li>Another item
<li>Yet another item
</ul>
Than this: <ul>
<li>Item 1</li>
<li>Another item</li>
<li>Yet another item</li>
</ul>That's surprising. They've saved me many times when files are opened and re-saved in different editors, from losing an accent or an em-dash halfway down the page where it's rarely noticed...
And my point is that the UTF-8 rule is not always followed, because source code gets passed around via e-mail, copied from browsers, edited in a console, saved with Notepad, and so on. Ideally file content would only ever be touched by source code editors configured only to ever operate in UTF-8 mode, but in the real world with real development teams and new interns, that is an impossible thing to ask.
At my last job, I made sure all accented characters in source code were only ever written with entity references, and we went from having weekly problems with accents somewhere on the site, to almost never.
I always have major problems with pretty quotes breaking when copying from GoogleDocs to Netbeans.
"That's how" becomes "That’s how"
<body onload="initialize()">
The Maps API documentation here https://developers.google.com/maps/documentation/javascript/... still recommends it. Fortunately, they seem to have updated their maps API code samples to use something like this instead
google.maps.event.addDomListener(window, 'load', initialize);
Probably a minor thing, but I've seen people, especially beginners, who pick up the former style (which is generally considered a bad practice) because they've seen it on places like the Google Maps API docs.
I've never heard a decent explanation for why, with this one. Unless you're intentionally creating a rule which is broad in scope, adding the element name helps document a rule, giving somebody who is unfamiliar with this CSS some context on how the rule is used. Other than saving a scant few bytes here and there, I can't see what the benefit is.
This just reminds me in my CSS, what declarations I can expect to come "by default" with the element. If it's a "span.x" then I know it has "display:inline" by default.
The only exception is that I generally don't specify with "h1", "h2", etc. because I'll want to be able to move those around in the HTML for SEO reasons, and not have to keep changing my CSS to go along.
It's unnecessarily limiting you to that one tag.
E.g., An e-commerce site that displays products in both the main content region and the sidebar. Product names use h1 tags in the main content region and h2 tags in the sidebar. Selectors like h1.product-title and h2.product-title have different meanings, and they're more efficient than the alternative selectors #main .product-title and #sidebar .product-title.
From a performance standpoint, qualifying class and id selectors by the element type is probably less efficient than not qualifying them, so doing it unnecessarily makes the selector longer and more difficult to maintain and decreases performance.
and:
Use HTML5. HTML5 (HTML syntax) is preferred for all HTML documents: <!DOCTYPE html>.
Why not <!doctype html>?
But, it's not HTML document, it's XML. Otherwise I would gladly point out that they used UPPERCASE tags, they closed their tags and they did not omit a protocol in xsl.
CSS Formatting Rules > Selector and declaration separation
CSS Formatting Rules > Rule separation