My HTML Writing Style
Strike a balance between visible structure, less whitespace, less syntax and easier skim-reading.
- Choose elements for their semantic meaning and practical effects.
- Avoid metadata.
- Always leave out optional tags from lists and tables. (Leaving out
</p>can have side-effects.)
- Format the HTML like plain text.
- Headings have one blank line above, none below.
- Paragraphs and other block-level structures have one blank line above and below.
- When preceeded by a heading, the blank line above block-level elements is left out.
- Flatten the code so there is the minimum depth of nesting.
- Use nesting to refine and limit semantics where appropriate.
- Indent significant local nesting and nothing else. (F-shaped reading pattern.)
- Use speechmarks around all attribute values.
- Use fewer attributes wherever possible.
classattributes as styling hooks only when no adequately supported CSS selector exists.
classvalues must describe the purpose, not the presentation.