Validation & Conventions

Validate Your HTML

Browsers are forgiving: broken HTML often still displays. But it may behave differently between browsers and break screen readers. Check your pages with the W3C Markup Validator (validator.w3.org) and fix errors.

Style Guide

  • Always declare <!DOCTYPE html>, lang and <meta charset="UTF-8">.
  • Use lowercase element and attribute names, and quote attribute values.
  • Close all elements; indent nested elements consistently (2 spaces is common).
  • Always specify alt, width and height for images.
  • Use semantic elements before generic <div>s.
  • Keep CSS and JavaScript in separate files.
  • Use lowercase file names without spaces: about-us.html.