问题
I am trying to link to a specific id on another page in a rails app. The html markup that I am targeting is:
<h3 id="about">About</h3>
When I manually put localhost:3000/#about into the browser address bar, it opens up to the correct spot in the page in Chrome and Safari. But when I paste that path into Firefox, it seems to stall - it opens up midway through the first page. Then if I hit enter on my keyboard again in the address bar, it goes to the correct spot.
Any ideas what may be causing this? Curious if I am following the correct conventions and have already taken a look at this excellent post - HTML Anchors with 'name' or 'id'?.
Any suggestions or ideas would be appreciated! Thanks
回答1:
Try exactly anchors thats given below and tell me if its working or not.
<div class="one"> <a href="#details">Click Here To Go There</a> </div>
<div class="two"> <a name="details">There</a> </div>
You have to position the div classes accordingly.
来源:https://stackoverflow.com/questions/15551621/linking-to-an-id-not-working-in-firefox-working-in-chrome-safari