Search code examples
htmlcssbuttonhref

I want Href to take me to a part of another webpage


This is how the page is shown when the button is clicked in the other 2 pages[![And how it should be]2I have a website with 3 pages and in each of one them is a button which should take me to a bottom part of the main page.

index.html is the main page and #r is for it to take me to the bottom part. When i click the button on that page it works perfectly, but when i do it on one of the two other pages it redirects me to the main page and the part i wanted but without all the css classes. How can i fix this? href="./index.html/#r"

I have tried different approaches but none of them seems to work.


Solution

  • It's not href="./index.html/#r", (i.e. #r is not a separate file and index-html is not a directory in the filepath), but the anchor is directly appended to the filename of the page, like href="./index.html#r"