How do you link (with <a>
) so that the browser goes to certain subheading on the target page as opposed to the top?
If there is any tag with an id
(e.g., <div id="foo"
>), then you can simply append #foo
to the URL. Otherwise, you can't arbitrarily link to portions of a page.
Here's a complete example: <a href="http://example.com/page.html#foo">Jump to #foo on page.html</a>
Linking content on the same page example: <a href="#foo">Jump to #foo on same page</a>
It is called URL fragment.