For those of you who don’t know here’s a small list of best practises for building (X)HTML websites. Most of them should be common knowledge.
1. Identify needed browser support
Before developing a website identify which browsers need to be supported (old browsers, mobile browsers, etc). This can have a huge impact on your design.
2. Use the correct doctype
The doctype specifies which version of (X)HTML is used. See my earlier post on HTML vs XHTML. I currently prefer XHTML 1.0 Strict.
3. No Frames
Don’t use framesets, they are deprecated.
4. No Tables for styling
Don’t use tables for styling. Why not ? Amongst others, maintenance is complex, browser load time is longer. Tables should only be used for tabular data.
Use style properties like float, display, overflow, position, margin, padding, etc to get the same results.
5. Use CSS for styling
Separate content and presentation by putting all the styling in Cascading Style Sheets (CSS).
6. Use a clientside scripting library
Use a clientside scripting library like e.g. jQuery. These libraries simplify the javascript and it shields the script from browser dependencies.
7. Write “Unobtrusive javascript”
Don’t use inline Javascript within your HTML, register events programmatically (see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript).
8. Progressive Enhancement
Use progressive enhancement within the design (see http://en.wikipedia.org/wiki/Progressive_Enhancement).
9. Validate your (X)HTML / CSS
Check regularly if your (X)HTML and CSS are valid. You can do this using tooling like the W3C Markup validation service, HTML Validator extension for Firefox or IE8 Developer Tools.
10. SEO Test
If your site should be indexed by Search Engines then do SEO testing regularly, see previous post .