Document Type Declaration and Validation
In order to build a ‘valid’ website you will have to define first what standards you want to follow. In other words you need something to tell the validation engine ‘This page is coded following this standard’.
This declaration need to appear in your page, before any markup of any type. It takes the form of a line of code, for example :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
HTML 4.01 allows 3 different DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Strict doesn’t allow you to write any presentational markup.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Transitional allow deprecated and presentation markup.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
Frameset must be used when your page use frames.
XHTML 1.0 use the same DTD names and syntax:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
All the xhtml 1.0 DTD have the same restriction as the html 4.01 DTD except that the code must also follows the XML syntax rules.
Don’t follow the standard set up in your document and you will end up with an error in the validation report.
You can test your site on the w3c website.
