html学习——超链接标签

超链接标签

a标签

<a herf="要跳转的链接">点击我跳转到页面</a>

示例

<a herf="http://www.baidu.com">点击我跳转到百度</a>
<a herf="https://editor..net/md/?articleId=113860012">点击我跳
转到我的第一篇博客</a>
<a herf="http://www.kafuchino.vip">点击我跳转到智乃导航</a>

target属性:表示链接在哪里打开

self属性:在当前页打开(默认)
_blank : 在新标签页打开
<a herf="http://www.baidu.com" target="_blank">点击我在新标签页打开
百度</a>

锚链接

需要一个标记,可以跳转到该标记

使用name属性作为标记

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>index</title>
</head>
<body>
<a name="top">顶部</a>
<!--在此创建top标记-->
<a herf="#down">去往底部</a>

<p><a herf="http://www.baidu.com">点击我跳转到百度</a>
<a herf="https://editor..net/md/?articleId=113860012">点击我跳
转到我的第一篇博客</a>
<a herf="http://www.kafuchino.vip">点击我跳转到智乃导航</a></p>

<a name="down">底部</a>
<!--在此创建底部标签-->
<a herf="#top">回到顶部</a>
</body>

如下图即可设置一个顶部标记

点击后页面跳转至标记所在位置

锚链接应用

<a herf="index.html#top">点击可以跳转到index.html的top属性位置</a>
<a herf="index.html#down">点击可以跳转到index.html的down属性位置</a>

功能性链接

邮箱

经验分享 程序员 微信小程序 职场和发展