I am trying to get a link back to the top of the page I'm on.
For the anchor, I've got
and for the link I've got
It works (or maybe it doesn't work!) in IE6/Win and IE5.2/Mac, but in Safari it will only take me right back to the top of the page if I put the anchor tag in the <body> and before the first <div>. If I put it inside an existing <div> the link takes me back to below the top of the page. If I create a separate <div> for it or put it inside <p> tags it throws out the layout. But the page fails validation for XHTML strict if the anchor goes within the <body> tag.
Am I using the correct syntax or should it be done differently if I'm using CSS/XHTML? (My experience up until now has been HTML only.) Or have I missed something?
I can post the code for the whole page if that will help.
Thank you.
Helen
For the anchor, I've got
Code:
<a name="topofpage" id="topofpage"></a>
Code:
<p><a href="#topofpage">back to the top</a></p>
Am I using the correct syntax or should it be done differently if I'm using CSS/XHTML? (My experience up until now has been HTML only.) Or have I missed something?
I can post the code for the whole page if that will help.
Thank you.
Helen
Comment