-
Human Readable
Code is written and maintained by people. Ensure your code is descriptive, well commented, and approachable by others.
-
HTML5 doctype
Enforce standards mode in every browser possible with this simple doctype at the beginning of every HTML page.
-
Syntax
- Use soft-tabs with two spaces
- Nested elements should be indented once (2 spaces)
- Don't include a trailing slash in self-closing elements
-
Attributes
- Attributes should be lowercase.
- Always use double quotes ("), never single quotes.
- Boolean attributes should be used without quoted values to avoid redundancy.
-
Attribute order
HTML attributes should come in this particular order for easier reading of code.
id
class
data-*
for
|type
|href
|src
-
HTML Comments
- Section comments are separated from the previous block by two lines, and should have one following line of space.
- Prepend section headings with an equal sign (=), to make a Find operation easier.