Click the navigation bar to jump to the corresponding position on the page
The a tag is the most convenient way, but there is no sliding or sliding animation, it is directly switched to the specified position
html code:
<body>
<div> <!-- 导航栏 -->
<a href="#first">首页</a> <!-- href="#" 或者 href="#top" 也可以转到顶部 -->
<a href="second">第二页</a>
<a href="third">第三页</a>
</div>
<!-- 不同页面 -->
<div id="first">首页</div>
<div id="second">第二页</div>
<div id="third">第三页</div> <!-- <a href="#bot">第三页</a> 也可以转到顶部 -->
</body>
Modify the a tag style css code:
a {
text-decoration: none; /* 去掉下划线 */
color: white; /* 去掉默认字体颜色:紫色 */
}
a tag other functions:
mailto: click to send email
tel: click to call