- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Tue, 17 Feb 2004 13:39:24 +0200 (EET)
- To: "www-validator@w3.org" <www-validator@w3.org>
On Mon, 16 Feb 2004 cg106@gre.ac.uk wrote: > I am using <legend align="center"> but it says that align cannot be center, > must be top, bottom or left. Actually I think it says top, bottom, left, or right. > However when I looked up the Legend tag at W3 > Schools, it states that align can be left, center, or right. The W3 Schools document is in error. This is understandable (though not acceptable), since the align attribute is rather confusing. Several HTML elements allow an attribute called align, but both the set of accepted values and the meaning of the attribute vary in a way that makes me dizzy. Various non-authoritative references and tutorials often get these things wrong. > Is this an error in the validation service?? No. Actually what matters is what there is in the DTD that your document refers to in its doctype declaration. That alone determines what a validator reports as an error. And the DTD says <!ENTITY % LAlign "(top|bottom|left|right)"> <!ATTLIST LEGEND %attrs; -- %coreattrs, %i18n, %events -- accesskey %Character; #IMPLIED -- accessibility key character -- align %LAlign; #IMPLIED -- relative to fieldset -- > which is probably understandable enough even if you are not fluent in SGML. Several browsers, such as IE and Mozilla, accept <legend align="center"> too, but it's not "standard" HTML. You could use CSS to suggest the centering, and Opera centers the legend if you use <legend style="margin: 0 auto">. But IE doesn't understand this. The details are matters of practical authoring, perhaps best discussed in news:comp.infosystems.www.authoring.stylesheets, but to achieve maximal browser support to your wishes of centering the legend, you would use <legend style="margin: 0 auto" align="center"> It won't be valid under any doctype in HTML specifications, but if desired you can create yourself a doctype of your own where you e.g. add center into the list of permitted values. The purpose would be to let you check your documents' syntax so that it deviates from the specifications only in the ways that you have decided to deviate. -- Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Tuesday, 17 February 2004 06:39:26 UTC