HTML文档中的锚链接

HTML文档中的锚链接,html,anchor,Html,Anchor,在这个URL上 boiseresturants.com/mexican/baja-fresh-mexican-grill.html 我有一个看起来像 <a href="#takemehere">his is a test</a> 现在我希望上面的链接显示为 boiseresturants.com/mexican/baja fresh mexican grill.html#takemehere 但它指向 boiseresturants.com/#takemehere

在这个URL上
boiseresturants.com/mexican/baja-fresh-mexican-grill.html

我有一个看起来像

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

现在我希望上面的链接显示为
boiseresturants.com/mexican/baja fresh mexican grill.html#takemehere

但它指向
boiseresturants.com/#takemehere

为什么会这样?我以前从未见过这种情况。

元素导致了这种意外行为

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


您需要使用完整路径。

它跳转到主页的原因是页面在
中设置了


要么放弃这一点,要么更具体地使用你的锚,就像这样:

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

。选择问题中的代码,然后单击“代码”(看起来像双引号)以正确显示代码。或者将代码放在反勾号中(该键通常位于tab键上方)。
<a href="/mexican/baja-fresh-mexican-grill.html#takemehere">Take Me Here</a>