Reputation: 100
I have two html pages.
1. main page (it has all the links like a b c d )
2. details page (it has all the details of a b c d)
like this
when user clicks on link a it redirects in new window to details.html
it is working fine.
but the problem is when user clicks on link 'd'
. it also redirects to details.html
but d
link details are somewhere at the bottom of page and user have to scroll it to fine d.
i want to do the automatic positioning of details.html
like if d link is clicked it should get to details.html
in new window. and displaying d at the top of page. see user don't have to scroll it manually.
Any possible Solution. I don't know what should i write to google it. Thanks
Upvotes: 0
Views: 455
Reputation: 4873
You use an ID, and a #
in the URL to do what you want.
Given a details page that looks something like this:
<div id="a">
<h1>Details about A</h1>
</div>
<div id="b">
<h1>Details about B</h1>
</div>
<div id="c">
<h1>Details about C</h1>
</div>
<div id="d">
<h1>Details about D</h1>
</div>
You would then link like such:
<a href="/details.html#d>Link to Details about D</a>
Basically, give an element an ID which, as always, represents what it contains
Link to it by putting that ID after the pound sign
<a herf="/LINK_TO_PAGE#ID_ON_PAGE">...
Upvotes: 2