HTML <!DOCTYPE> declaration
The <!DOCTYPE> declaration is the very first thing in a document, even before the <html> tag. It informs the web browser what type of document your webpage will be.
There are three document types specified in HTML and XHTML which are Strict, Transitional, and Frameset. The difference between the HTML and XHTML document types is that for the HTML document types your code does not necessarily have to adhere to proper syntax rules, while for XHTML it must.
!DOCTYPE Examples
HTML Strict document
Contains no deprecated elements or attributes and no frames.
HTML Transitional document
Contains all elements and attributes (including the deprecated ones), but no frames.
HTML Frameset document
Same as HTML transitional but uses frames.
Strict XHTML document
Contains no deprecated elements or attributes and no frames AND must adhere to proper XHTML syntax rules.
Transitional XHTML document
Contains all elements and attributes (including the deprecated ones), but no frames AND must adhere to proper XHTML syntax rules.
Frameset XHTML document
Same as XHTML transitional but uses frames.
XHTML 1.1 document
Same as XHTML Strict but lets you add XHTML modules.
An entire document using the XHTML strict document type
Tips & notes
Make it a habit of always including the !DOCTYPE declaration in every webpage you create, even offline pages. Including the !DOCTYPE declaration in every page results in less validation errors which means less time spent fixing errors which means more time for fun happy things that you like (besides writing code, of course).
Use the W3C's webpage validator to validate yourpages.