- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Sat, 24 Jan 2009 13:33:51 +0200
- To: "Graham Brown" <graham_a_brown@hotmail.com>, <www-validator@w3.org>
Under Subject: Re: Add Subject Here Graham Brown wrote: > I appear to be having problems with the validator. I am currently > wrtiting a new textbook for IGCSE ICT and have the folllowing code in > an example. It appears to be structured correctly yet the validator > fails it? In future, please use a descriptive Subject line and include a URL of the document you have problems with. (In this case, you included the entire document, which isn't very long, so the lack of a URL was not as serious as so often.) > <!-- <!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//EN" > "http://www.w3.org/TR/html4/strict.dtd"> Why do you have the comment there? It's valid but very pointless: it just makes a human reader wonder why it is there, compare it with the doctype declaration, etc. Moreover, it has the fairly serious effect of throwing Internet Explorer into Quirks Mode. > <table border="1"> > <caption>Fruit sales</caption> > <thead> [...] > </thead> > <tbody> [...] > </tbody> > <tfoot> As far as validity is concerned, the only problem is that the tfoot element is misplaced. The validator says this rather clearly, though somewhat abstractly: 'document type does not allow element "TFOOT" here.' You have put the tfoot element after the thead and tbody elements. This sounds natural, but the HTML specifications say that if it is present, it must appear before any tbody element. What matters in validation is that this rule is formalized in the DTD: <!ELEMENT TABLE - - (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)> This says that the contents of a table element consists of the following, in this order: - caption element (optional) - a sequence of col elements or a sequence of colgroup elements or neither of these - a thead element (optional) - a tfoot element (optional) - a sequence of one or more tbody elements. (I guess the reason for the somewhat odd position of the tfoot element is twofold: it was regarded as comparable to the thead element, and people could not agree on, or could not just define, the meaning and intended use of the tfoot element.) -- Yucca, http://www.cs.tut.fi/~jkorpela/
Received on Saturday, 24 January 2009 11:34:53 UTC