The Standards Compliant Foundation

By Posted in - Web Development on July 10th, 2008 0 Comments

Everyone's heard it said before in reference to a myriad of different subjects, "Every building needs a solid foundation in order to withstand the elements and everyday use. [Insert topic] is similar to the building in that it needs a solid foundation as well."  I wish I could spare the metaphor, but alas, I cannot.

Think of the site as the building and the web browser as the ground  the building will sit on (if IE6, we're talking about the absolute dirtiest, filthiest, goopiest mud than can by imagined… think man-eating.)  We're also going to need some foundation to lay that will lend solid footing.  In the case of our standards-compliant website, that foundation will be our DOCTYPE.  What exactly is a DOCTYPE?  Well, it's a single tag inserted on the first line of any page that tells web browsers how to translate the rest of the code that follows.  In the (X)HTML world there are seven basic choices:

HTML 4.01 STRICT,  TRANSITIONAL, FRAMESET

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

XHTML 1.0 STRICT, TRANSITIONAL, FRAMESET

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Which DOCTYPE to use in a specific instance would be another entire article in itself, but for further reading, view WDG's DOCTYPE page.  Also, more can be found on Web Standards Project and W3C.

It's always a good idea to double-check your DOCTYPE, especially if using web authoring software.  Even some of the larger suites include incomplete or invalid DOCTYPEs in their page templates.  Ensuring that the DOCTYPE is correct will save plenty of time when debugging a site.

Once the footing is down, we get to move on to constructing the "first floor" of our building.

…Next time The <head> Section

Please leave a Comment