04. html 超链接 a标签

html 超链接 a标签

目录

  • 超链接 a 标签的使用
  • a标签配合 name 锚点的使用
  • base标签的使用
  1. 超链接 a 标签的使用
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>HTML超链接</title>
</head>
<body>
	<a href="https://www.baidu.com" target="_self" title="">点击跳转百度</a>
	<br>
	<br>
	<a href="https://www.baidu.com" target="_blank" title="">点击跳转百度-新窗口打开</a>

	<!-- 
		a超链接
			target - 打开方式
				_blank	新窗口打开
				_self	默认窗口打开
	 -->
</body>
</html>
  1. a标签配合 name 锚点的使用
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>a链接_锚点name</title>
	<style type="text/css">
		.item{
			display: block;
			width: 500px;
			height: 500px;
			border: 1px solid #ccc;
			text-align: center;
			line-height: 500px;
		}
	</style>
</head>
<body>
	<!-- 上面 a 标签的 href属性  对应下面的 name 属性 -->
	<a href="#item1" title="">百步飞剑</a>
	<a href="#item2" title="">夜尽天明</a>
	<a href="#item3" title="">诸子百家</a>
	<a href="#item4" title="">万里长城</a>
	<a href="#item5" title="">君临天下</a>

	<a href="#" class="item" name="item1" title="">百步飞剑</a>
	<a href="#" class="item" name="item2" title="">夜尽天明</a>
	<a href="#" class="item" name="item3" title="">诸子百家</a>
	<a href="#" class="item" name="item4" title="">万里长城</a>
	<a href="#" class="item" name="item5" title="">君临天下</a>
</body>
</html>
  1. base标签的使用
    作用,控制页面的所有a链接是否新窗口打开
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>base标签</title>
	<base target="_blank">
</head>
<body>
	<a href="http://www.baidu.com" title="">点击跳转百度</a><br>
	<a href="https://www.imooc.com/" title="">点击跳转慕课网</a><br>
	<a href="https://music.163.com/" title="">点击跳转网易云音乐</a>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值