繁体   English   中英

链接到新HTML页面中的部分

[英]Linking to a section within a new HTML page

我正在为网站创建一个导航栏,我想按钮链接到我主页上的联系人部分(index.html)。 目前,如果您在拥有我的投资组合的页面上并希望转到此部分,它只会转到我的主页的顶部,而不是大约在页面中间的联系部分(具有alt标识“#contact”。

我目前在我的navbar类中有这个代码:

<a href="index.html" onclick="w3_close()" class = "bar-item button center">CONTACT</a>

如何直接将其从外部页面上的链接转到带有ID的元素?

做这个:

<a href="index.html#contact" onclick="w3_close()" class = "bar-item button center">CONTACT</a>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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