Click to skip over navigation
 

lecture 6: validation

<< previous slide

return to lesson 6 index

next slide >>


The first step towards writing sites that are compatible with the maximum number of browsers is to use well-formed HTML. This rather hearty-sounding term refers to nothing more than code which contains no missing closing tags, stray attributes, etc.: in other words, valid code. (Technically well-formedness and validity are two slightly different things but we can combine them for the purposes of this page.)

One problem with Internet Explorer is that it is quite tolerant of mistakes in the code. This might seem like something which is better for designers, but actually it's worse, particularly if the only browser on which you've tested your site is IE. The page on the right contains a deliberate mistake: it has <table> at one point where it should have been a </table>. IE (top screen shot) has brushed this off, but in Opera (bottom), you can see it has rather strange results.

Obviously, to uncover an error like this requires only that pages are viewed on different browsers before they are released. Then, the mistake becomes clear: although this does not mean it is easy to spot the cause of the mistake. But there are other sources of help here. Because the standards of XHTML 1.0 are fixed, it is not difficult to run a program which can test a web page's adherence to those standards. This process is known as code validation.

A validation service is available on the World Wide Web Consortium's site. If you want to use it - and I recommend it to anyone taking web design seriously - please read the page on validation in the online teaching materials. You need to have used structural tags correctly, particularly the <!DOCTYPE> declaration and <meta> tags. And as I advise on the more detailed page, this can be a slightly intimidating experience for beginners as validators may well come up with dozens of errors when a page is first tested. Often, though, these may be caused by only one or two actual errors in the code. Note also that validation is a useful debugging service in its own right, enabling you to spot the missing quotation mark or angle bracket which is causing your whole page to break. Do experiment with it after this lecture, and come to your own conclusions.

Whether you use the code validator or not please remember the point with which I started this slide; that writing valid, well-formed code is an important first step towards writing accessible web pages.

Screen Shot: page with bad table code in IE (looks fine)


Screen Shot: same page in Opera (looks very strange)



<< previous slide

return to lesson 6 index

next slide >>