简体   繁体   中英

Anchor links in HTML documents

At this URL

I have an anchor link that looks like

<a href="#takemehere">his is a test</a>

Now I expected the above link to appear as

But it points to

Why is this happening? I have never seen something like this before.

The base element is causing that unexpected behaviour...

<base href="http://www.boiseresturants.com/" />

You'll need to use the full path.

The reason it's jumping to the home page is because the page has <base> set in the <head> :

<base href="http://www.boiseresturants.com/" />

Either drop that or be more specific with your anchors like so:

<a href="/mexican/baja-fresh-mexican-grill.html#takemehere">Take Me Here</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM