"Separate structure from presentation from behavior."
"Strictly keep structure (markup), presentation (styling), and behavior (scripting) apart, and try to keep the interaction between the three to an absolute minimum."
"...Move everything presentational into style sheets, and everything behavioral into scripts."
"In addition, keep the contact area as small as possible by linking as few style sheets and scripts as possible from documents and templates."
"Separating structure from presentation from behavior is important for maintenance reasons. It is always more expensive to change HTML documents and templates than it is to update style sheets and scripts."
"For file size optimization and scannability purposes, consider omitting optional tags. The HTML5 specification defines what tags can be omitted."
"...For consistency and simplicity reasons it’s best served
omitting all optional tags, not just a selection."
type Attributes
Omit type attributes for style sheets (unless not using CSS) and scripts (unless not using JavaScript).
Specifying type attributes in these contexts is not necessary as HTML5 implies text/css and text/javascript as defaults. This can be safely done even for older browsers.
Use a new line for every block, list, or table element, and indent every such child element.
column 1 | column 2 |
---|---|
Also, indent them if they are child elements of a block, list, or table element. | (If you run into issues around whitespace between list items it’s acceptable to put all li elements in one line. A linter is encouraged to throw a warning instead of an error.) |
While there is no column limit recommendation for HTML, you may consider wrapping long lines if it significantly improves readability.
When line-wrapping, each continuation line should be indented
at least 4 additional spaces from the original line.