Some good practices on XHTML
- <doctype> always use a doctype before <html>-tag: don’t get in quirksmode –recommended list of doctypes (W3 schools)
- Transitional is most common
- Strict: prohibits the use of target=”_blank” and a few other HTML tags, like s, center, strike, u, applet, iframe, font, isindex, dir, basefont
- <h1> Only one h1 per page: use for the main topic
- <blockquote> Only to refer to bits of text coming from other locations
- <q> Use for a single ‘quote’
- <table> Never use for lay-out purposes
- <cite> References to books, websites, articles
- <address> identify contact information to the author of a page
Other usefull tips
Disallow compatibility mode
Tell Internet Explorer never to go into compatibilty mode (use an older IE engine than the one installed). Put this after the <title>-tag:
Linking style sheets
Use <link> for simplicity and better performance
Validate your code
http://validator.w3.org
Forget about HTML attributes like
- vspace
- hspace
- bgcolor
- text
- link
- alink
- vlink
- img align: use CSS-floats instead
Low level format browser specific attributes like
- leftmargin
- topmargin
- marginwidth
- marginheight