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"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
XHTML 1.0 STRICT, TRANSITIONAL, FRAMESET
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
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