Validation and Standards

Validating Your Web Pages

How do you know that your web page is written correctly? What if you page doesn't display properly in a particular browser - is it your fault, or the browser's?

The W3 Consortium has a useful Validation Service that will check whether any web page obeys the standard. If you follow the link, you can enter any URL and the Validator will check the page, and report whether the page passes or there were errors and/or warnings.

Try validating your page now. Does it pass? You'll probably find at least two errors; see below...

Which Mark-up Standard?

Today there are several different standards for web pages, each with slightly different mark-up. How does a web browser know which one you're using?

There is an HTML tag to tell the browser which standard you're using. Today we're using HTML 4.01 (Transitional), so you can tell the browser this by placing:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
as the first line of your document.

In order to validate your web page, the Validator needs to know which standard you are using.

Character Encoding

Different languages need different letters, and so around the world there are slightly different ways of "encoding" text. Generally speaking the usual alphabetical and numerical symbols have the same "code", but accented characters and symbols may vary.

The web browser needs to know how your text is encoded, i.e. which codes mean which symbols. We can tell it this in the head section, e.g.:

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
which uses the UTF-8 encoding.

Common Errors

There are lots of mistakes that might cause your web page to fail the validation - don't forget to scroll down on the validation page to read what was wrong! Some of the more common mistakes are:


Previous page Next page