Go to Page Top

How can I make it so if a person clicks on the “Page Top” link, they are taken to - you guessed it! - the very top of the web page??

I tried adding an anchor (?) like this…


<body>
<!-- Added 2014-05-18 -->
			<div id="start"></div>

…but when I do that, it is only taking the user to the top of the article, and not the very top of the page like you’d see if you loaded the page fresh.

Make sense?

Sincerely,

Debbie

Does the <body> tag of your page have an ID? If it doesn’t, you can add one :slight_smile:


<body id="bigpage">

Then, you can create a link to that ID:


<a href="#bigpage">Page Top</a>

Hmmm… Strange… Yours works and mine didn’t?!

I guess to go to the page top, I needed an anchor - is that what it is called?? - in the <body> tag and not right below it…

Sincerely,

Debbie

You can place a link/anchor anywhere on the page. E.g.

<a href="#top">Return to Top</a>

This assumes you have an id of “top” on the boy tag (or at the top of the page, like on the header element etc.).

No, I’m trying to get my terms down right…

What is this called…


<body id="start">

And what is #start called in this link…


<a href='www.debbie.com/articles/some-really-interesting-article#start'>Page Top</a>

Debbie

id=“start” is called an ID.

#start used there is called a fragment identifier.

Hmmm… I did not know that?!

(For some reason, I thought it was called an “anchor” or maybe a “bookmark” or I dunno…)

Thanks,

Debbie

http://www.w3.org/DesignIssues/Fragment.html

http://www.w3.org/MarkUp/html-spec/html-spec_7.html

Yeah, I already read those.

Sure there isn’t maybe another name that it is called though?

Debbie

No. On the web, one can find misnomers for most anything :slight_smile:

I believe some of the confusion is because not so long ago if you wanted a “go to top” link the only way to do it was with an
<a name="top">
i.e. an a (anchor) tag.

Since then browsers now support going to elements by id.

As Ron mentioned, because some “legacy” things have evolved, the terminology is a bit of a misnomer.

Web dev has a few things that I consider a bit “odd”, eg. start counting at zero instead of one :fangel:
Confusing unless you know the history involved.

I think you may be on to something! :wink:

Thanks,

Debbie