Part 2 - (X)HTML
What is valid code?
Validation is a process of checking your documents against a formal standard, like those published by the W3C. A document that has been checked and passed is considered valid.
Why use valid code?
- Valid code will render faster than code with errors
- Valid code will render better than invalid code
- Browsers are becoming more standards compliant, and it is becoming increasingly necessary to write valid and standards compliant HTML
How do you check if your code is valid
How do you make your code valid?
- Start with the right doctype
- Be aware of doctype modes (standards compliant, quirks mode etc)
- Use a character set
- Close HTML elements
- Use alt attributes for images
- Avoid HTML hacks
- Use HTML validators regularly
- Fix any bugs you find before you go live
- Make validation part of your normal work process
External resources: