In HTML, url contains #, scrolls the page to the title?

If my url looks like: http://www.thisisawebsite.com/page.php#about
How do I click a link to go to the "about" heading or somewhere else that I want so much?

+4
source share
2 answers

You need to define an anchor in your markup (next to the "About" heading):

<a name="about"></a> 

EDIT:

Because of the discussion, snarky downvotes (BTW - I supported Richard Jordan) and my own edification; anyone else who has a question about this should investigate the use of the ID attribute for the actual element to which they want to bind:

 <h1 id="about>About</h1> 
+2
source

Just mark the title on the landing page with the identifier "about" ie

 <h1 id="about>About</h1> 

So your link on the link page http://www.thisisawebsite.com/page.php#about will go straight to the about about - h1 heading in this example, but it could be that you gave the identifier "about". Remember that you should only use the "about" identifier once per page.

+8
source

Source: https://habr.com/ru/post/1441800/


All Articles