The basic web page: Validation

  1. Character styles
  2. The basic web page

I’ve talked a little about the difference between XHTML and HTML. But how does the browser know the difference? You need to tell it.

Document Type

Unless you’ve got a good reason, I recommend using either XHTML 1.0 Strict or HTML 4.0.1 Strict. In this tutorial I’m using XHTML. You can read more about them on Wikipedia and at

Replace the opening <html> tag with this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

<html xmlns="" xml:lang="en" lang="en">

You may find it useful to copy and paste, and I’ve also provided this snippet in the snippets folder of the resources folder.

You must specify a DOCTYPE. If you don’t, browsers are likely to assume you don’t know what you’re doing, and not let your page use some features of modern HTML and XHTML.

Character set

The computer world is filled with different character sets, and in a world where lots of different software on lots of different computers all read the same files, it’s important to know which character set was used. Computers work with numbers; every letter and every digit and everything that comes off of your typewriter is represented as a number when it gets saved to a file. The problem is that different software often use different numbers to represent these characters. For example, character 211 in one character might be the closing double quotes. In another, 211 could be an accented capital O.

It’s a good idea to specify which character set you’re using. I recommend utf-8 unless you’ve got a good reason to do otherwise.

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

This is a standard <meta> tag and it goes in the <head> of the document. You’ll also need to tell your text browser that you’re using UTF-8.


You can (and should, often) go to to validate your web pages. You can also download a stand-alone application for Mac OS X at

When you validate your web page, the validator will tell you if there are any mistakes in the actual HTML or in the character set. Fixing these errors will make your web page display more reliably on more web browsers.

image 10
  1. Character styles
  2. The basic web page