0

hello there I'm having problems understand how this is done .. some websites I've visited when i read a post and they are emphasising on a particular part i must have past they set up a link like text and when i click on it , it takes me back to that particular point of the thread im reading.. it doesn't actually reloads the page or something. ... please how can i achieve this ... it seems like they use 'http://url.com/thread-name#particularpoint' ... but how do i do it ... thanks

Bright umor
  • 59
  • 1
  • 6
  • 1
    Possible duplicate of [Link to an element within the current page](https://stackoverflow.com/questions/12386212/link-to-an-element-within-the-current-page) – OneNeptune Jun 11 '17 at 19:48
  • 1
    Possible duplicate of [html link to the middle of another page](https://stackoverflow.com/questions/15885051/html-link-to-the-middle-of-another-page) – Daniel Beck Jun 11 '17 at 20:38

2 Answers2

1

the href attribute takes the url for the page you want to link to. but you can also point to a particular section of the page when clicked on the link.

suppose you are at page and want to jump to the footer when clicked on the link without reloading the page. simply do

<a href="#footer">click here to go to footer</a>

simply add an id footer to the footer div and the work is done... you will see the url changes to http://previous/url/of/page#footer

<div id="footer"> footer section </div>

*note -> use '#' for id and '.' for class.

Ankush Verma
  • 178
  • 1
  • 9
1

If you use the permalink, then, the cusor would be moved to that part of the page. For example.

    <div> <a href="#next">If you click this permalink</a></div>
    <div id="next"> You will land here</div>

That's pretty much it. It works well for sites with too much content and yet, you want to keep your visitors from leaving based on their interests.