views:

40

answers:

4

well we can have name anchors in our page like the following code

<!---Some HTML Code-->
<a href="#Mark_1">Mark 1</a>
<a href="#Mark_2">Mark 2</a>

<!---After some HTML Code-->
<a name="Mark_1">


<!---After some HTML Code-->
<a name="Mark_2">

by doing so we provide links that to scroll up and down a page and all but

I have seen several times on the net that when you click a link and a new page is opened and it contains many subjects but page is scrolled to the desired position.

HOW THAT IS DONE

for example, in stackoverflow's recent activity when we click some activity the relevant page is opened and page is scrolled to that activity out of many... this is just an example.. i don't want how stackoverflow does it... what i want how is this done or is there any name for this technique

A: 

you need

<a href="#Mark_1">Mark 1</a>

note the hash

second
then edit the question... don't post an answer
Junaid Saeed
A: 

It's doing exactly what you're talking about, a named anchor. So the link looks something like this:

<a href="http://stackoverflow.com/questions/3549590/in-depth-ruby-gem-development-resources-book-video-sites/3550910#3550910"&gt;&lt;/a&gt;

Notice the '#' in the href (... 3550910#3550910), that's the named part. Takes you right where you want to go.

Btw in your example above your link to the named anchor should be

<a href="#Mark_1">Mark 1</a>

Notice the hash

brad
i said i don't want how stackoverflow does it... i think nobody read the question and just considered it to be a simple thing asked and hurried to answer
Junaid Saeed
that's all fine and well but explaining what stack does IS answering your question at the same time. It's a named anchor, case closed, no need for downvotes.
brad
A: 

I think you have it right, but you just need to add the target attribute.

<a href="#Mark_1" target="_blank">Mark 1</a> 

This will open the link in a new page and should position it down the the anchor. I normally use the full URL in the href section though.

Tim Meers
A: 

You can append a hash with following the the value of the id attribute of any HTML element. See this example: http://en.wikipedia.org/wiki/Html#Attributes

It links directly to the section about "Attributes". In this section it also discribes the technique :)

Kau-Boy
awesome...........................
Junaid Saeed
you rock man..........
Junaid Saeed
i am so happy with your answer man... that i am gonna go to your profile and up vote all your questions....
Junaid Saeed
I am glad I could satisfy you so easily :)
Kau-Boy
you went from 1441 to 1571
Junaid Saeed
Thanks for that!
Kau-Boy