1.链接是由<a>元素建立的,用户可以单击位于起始标签<a>和结束标签</a>之间的任何内容。使用href特性来指定要链接到的页面。

2.什么是绝对URL,URL的全称是Uniform Resource Locator(统一资源定位器)。每个网页都有各自的URL,网页的URL就是访问这个网页时需要在浏览器上输入的网址。绝对URL以网站的域名开头,域名后面可以指定具体页面的路径。如果没有指定具体页面,网站将会显示主页。

3.如果只是链接到同一网站中的其他页面,则可以使用相对URL。在相对URL中不用指定网站的域名,有点像是绝对URL的简写形式。

4.如果是链接到网站内部的某个页面,相对于完全限定的URL,最好使用相对链接。

5.可以通过id特性将某个可链接的页面上的元素作为链接目标。

 

 

示例:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>指向其他网站的链接</title>
</head>
<body>
<p>Movie Reviews:
<ul>
<li><a href="http://www.empireonline.com">Empire</a></li>
<li><a href="http://www.metacritic.com">Metacritic</a></li>
<li><a href="http://www.rottentomatoes.com">Rotten Tomatoes</a></li>
<li><a href="http://www.variety.com">Variety</a></li>
<li><a href="http://www.baidu.com">Baidu</a></li>
</ul>
</body>
</p>
</html>



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>链接到当前页面的某个特定位置</title>
</head>
<body>
<h1 id="top">Film -Making Terms</h1>
<a href="#arc_shot">Arc Shot</a><br/>
<a href="#interlude">Interlude</a><br/>
<a href="#prologue">Prologue</a><br/><br/>
<h2 id="arc_shot">Arc Shot</h2>
<p>
A shot in which the subject is photographed by an encircling or moving camera
</p>
<h2 id="interlude">Interlude</h2>
<p>A brief,intervening film scene or sequence,not specifically tied to the plot,that appears within a film</p>
<h2 id="prologue">Prologue</h2>
<p>A speech,preface,introduction,or brief scene preceding the the main action or plot of a film;contrast to epilogue</p>
<p><a href="#top">Top</a></p>
</body>
</html>




<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>指向同一网站中其他页面的链接</title>
</head>
<body>
<p>
<ul>
<li><a href="link-to-other-sites.html">href</a></li>
<li><a href="linking-to-other-pages.html">a</a></li>
<li><a href="../ch03/demo.html">b</a></li>
</ul>
</p>
</body>
</html>



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>email链接</title>
</head>
<body>
<p>
<a href="mailto:3069418554@qq.com">**的QQ邮箱</a>
</p>
</body>
</html>