- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Sat, 19 Nov 2005 00:37:03 +1100
- To: Andy Walker <Andy.Walker@TopGPS.co.uk>
- CC: www-validator@w3.org
Andy Walker wrote: > I accept the anchor tag should be inside the <body> anchor *element*. > But with the anchor <a name="top"></a> even _immediately_ after the > <body> element there are a few pixels left undisplayed at the top of > the page when the jump is made to that point. The reason for that is because the body element has top margin and/or padding by default in most browsers. You can remove it using a stylesheet body { margin: 0; padding: 0; } You may adjust those to suit your needs to add left and right margin/padding if you like. That CSS will remove margin and padding from all sides. > Whereas if the <a name="top"></a> is missing (on purpose) then the > 'return to top' jump really does that... The fact that some non-conformant browsers choose to accept #top as an implied link to the top of the page is irrelevant. You cannot depend on such buggy behaviour to work in all browsers. > So... Leaving the anchor OUT means I get the functionality that I > need (& expect) but it causes many errors in the link-checker. Be careful of the "it works for me" syndrome. If a validator tells you your code is wrong, it's wrong. DO NOT accept the behaviour of your favourite browser(s) as being correct in all cases. > What I was trying to describe with the 'broken fragments' part was > that there are many portions of the source html where I've chosen to > layout the code for readability e.g. (layout 1): > > <area shape="poly" coords="218,55,213,51,204,54,205,61,212,60" > href="#place4" alt="Place 4" title="Place 4"> > > Rather than (layout 2): > > <area shape="poly" coords="218,55,213,51,204,54,205,61,212,60" > href="#place4" alt="Place 4" title="Place 4"> > > I've never read anything which says this is bad practice. Assuming you meant for the second to appear all on one line, both are correct. It does not matter whether a start-tag spans more than one line. > When the link checker notices that the <a name="top"></a> is missing > then it ALSO complains about the 'layout 1' style of source code - Now I understand what you mean and I see you are mistaken. You are not interpreting the results correctly. | ... | Lines: 20, 24, 28, 31, 80, 111 | Broken fragments and their line numbers: They need to be fixed! | top: 80, 111 The first set of line numbers (some of which match those of the area elements in your source) are merely advising you of the location of all the links to other fragments within the document. It does not say anything about them being invalid in any way. Only the two links to #top in this case, on lines 80 and 111, are broken. -- Lachlan Hunt http://lachy.id.au/
Received on Friday, 18 November 2005 13:45:03 UTC