DEV Community

Discussion on: What kind of coding standards do you follow when writing HTML?

Collapse
 
moopet profile image
Ben Sinclair

Aside from the stuff linters pick up:

  • Avoid unnecessary divs and spans, try to put content into the appropriately-semantic containers.
  • Only one opening or closing tag per line
  • Indent nested tags consistently (2 spaces is my preference, but that's all it is - a preference)
  • Use one line break as vertical whitespace between containing blocks.
  • Use one line break as vertical whitespace between unrelated meta tags, scripts, stylesheets, etc.

And I try to write it while keeping in mind that it's not necessarily going to be the only output format.