Hello, my name is Kelyn. I am currently working on the portfolio question and I have a really dumb question. How do I use an anchor tag to redirect someone on certain content on the same webpage. Please guys help me. I would really appreciate the help. Any form of help would be highly appreciated.
You can use:
<a href="#some_id">Link to div with id: some_id</a>
To link to some other element that has an id of some_id:
<div id="some_id">If you click the link you will go here...</div>
1 Like
google is your friend.
give the target an id.
<div id="target"></div>
set href of link to point to id.
<a href="#target">Take me to the target.</a>
edit… aand bengitter person beat me by seconds.
2 Likes
If there is an <a name="foo"> tag or 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>
Source: SO
1 Like
@BenGitter Thank you so much.