html超链接及锚链接的简单使用
一、创建外部超链接
1、在本页面中打开超链接
<a href="https://www.baidu.com">百度</a>
<a href="https://www.baidu.com" target="_self">百度</a>
注意: 默认情况下,target的值就是_self,所以上面第一条就算不指定target的值,也是直接在本页面中打开超链接。
2、在新的标签页中打开超链接
<a href="https://www.baidu.com" target="_blank">百度</a> //target的值为_blank的情况下,在新的标签页中打开超链接。
3、剩下两个target的值,_parent和_top都是用在iframe中,即内嵌网页时,控制跳转行为。_parent是跳转到上一级窗口,_top是跳转到顶级窗口。如果不用在iframe中,就如1中一样。
二、创建锚链接(即标记本html页面中的一个点,通过点击a标签,直接跳转到那个位置。)
1、构建锚点在本页面中跳转
第一种方式:id方式
<p id="top"><a href&