Coding Standards & Best Practices : HTML


Naming Conventions

  • All html tags and attributes in lowercase.
  • Class names or ids either hyphenated or camelcase. Preferably hyphenated

Basic standards

  • Use alt attribute in img tags
  • Dont forget to add a header tag inside a section block
  • Use unique ids

    Make sure your ids in a single page are unique. Having same ids would create problem when you try to access them

  • Avoid nesting of the following elements
    • label inside label
    • anchor inside another anchor tag
    • form inside another form tag
    • img, object, sub, sup inside pre tag
  • Make sure you close every element