Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create a hyperlink to a specific scroll position on a web page? For example, I'd like to create a link to, but with the page scrolled down 100 pixels.

share|improve this question
up vote 3 down vote accepted

You can scroll to a given position using the jQuery scrollTo plugin. If you have a look on its demo page, you'll see that the plugin is capable of many different options, including scrolling to a certain position. That would mean you'd have to control the target's JavaScript, though, so this might not be suitable for a link to an external site.

share|improve this answer

The vanilla way link to somewhere in-page is via an anchor point already present in the page.

This can be created using the <a>…</a> tag. Note that the link specified in "anchor point" (above) has #h-12.2 at the end. This corresponds to <a id="h-12.2">12.2</a> embedded in the HTML forming the page, and when clicked will reposition the page view to this anchor.

Note that prior to HTML5, the name attribute was used in the anchor tag, but is no longer supported and the id attribute should be used in its place (reference). This also means that you can use any element for an anchor tag, you are not limited to the <a> element.

share|improve this answer

Similar to Paul's answer, you can also link to the first occurrence of a tag ID in an HTML document. This won't be an exact number of pixels though.

For example, link/scroll to this page's question or answers.

share|improve this answer

Try right-clicking and Inspecting Elements on the page. You'll find the <a> tags, those are the anchor points.

Then take out the < before the first and last a so that they would not show up as the links. You can actually see the effects while writing in the response box when it shows you the preview below.

a href="">question /a>


a href="">answers /a>

As you can see, the only difference is at the very end where the anchor names after the pound (#) symbol. the name after the > is for how the link reads to the user.

In this case "question-header" reads as "question" and answers happens to be the same.

Then the following should link to Mike's comment. Since their anchor point is 382094

To clarify, you can simply find the anchor and add the # after your link.

these will all take you to different places on the same page.

share|improve this answer
Does this work only for IDs or does it work for class also? For example, if I had an element, say, <h3 class="theClass">Header</h3>, how can I link to this element which does not have an ID attribute value? – Ulysses Alves Nov 20 '15 at 16:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.