66.Pyhton修炼之路【71-前端-HTML链接】2018.06.28

html链接

html链接

        <a>标签可以在网页上定义一个链接地址,通过src属性定义跳转的地址,通过title属性定义鼠标悬停时弹出的提示文字框。

<a href="#"></a> <!--  # 表示链接到页面顶部   -->
<a href="http://www.itcast.cn/" title="跳转的传智播客网站">传智播客</a>
<a href="2.html">测试页面2</a>

定义页面内滚动跳转

        页面内定义了“id”或者“name”的元素,可以通过a标签链接到它的页面滚动位置,前提是页面要足够高,有滚动条,且元素不能在页面顶部,否则页面不会滚动。

<a href="#mao1">标题一</a>
......
......
<h3 id="mao1">跳转到的标题</h3>

target属性

示例:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>链接</title>
</head>
<body>
<a href="http://www.baidu.com" title="链接到百度网站" target="_self">百度一下</a>
<a href="http://www.sougou.com" title="链接到搜狗" target="_blank">搜狗</a>

</body>

</html>

注:target="_self" 打开新的页面   target="_self" 覆盖原来的页面

猜你喜欢

转载自blog.csdn.net/youyouwuxin1234/article/details/80841232