什么是超文本(Hypertext:HT)

来源:互联网 发布:linux 查看用户状态 编辑:程序博客网 时间:2024/06/11 18:54

超链接(Hyper text),按标准叫法称为锚(anchor),使用<a>表示,可以有两种方式:

1. 在文档中创建一个热点,。。。浏览器会自动加载并显示同一文档或其它文档中的某个部分,或触发与某些因特网服务相关的操作。

2. 在文档中创建一个标记,该标记可以被超链接引用。

两个属性:

1. href: <a href="url">Link text</a>

  • target属性:定义被链接的文档在何处显示
  • <a href="http://www.w3school.com.cn/" target="_blank">Visit W3School!</a>(在新窗口)

2. name: <a name="label">Text to be displayed</a>

  • <a name="tip2">Useful Tips Section</a>
  • 创建向相同文档中“Useful Tips Section" 的链接:<a href="#tips">Visit the Useful Tips Section</a>
  • 创建从另一个页面指向该文档中“Useful Tips Section"的链接:<a href="http://www.w3school.com.cn/html_links.htm#tips">Visit the Useful Tips Section</a>

注释:请始终将正斜杠添加到子文件夹:

href="http://www.w3school.com.cn/html"

href="http://www.w3school.com.cn/html/"


实例1:链接到同一个页面的不同位置

<html><body><p><a href="#C4">Go to Chapter 4</a></p><h2>Chapter 1</h2><p>This chapter explains blablabla</p><h2>Chapter 2 </h2><p>This chapter explains blablabla</p><h2>Chapter 3 </h2><p>This chapter explains blablabla</p><h2><a name="C4">Chapter 4 </a></h2><p>This chapter explains blablabla</p><h2>Chapter 5 </h2><p>This chapter explains blablabla</p></body></html>

实例2:跳出框架

<html><body><p>被锁在框架中了吗?</p><a href="/index.html" target="_top"请点击这里!</a></body></html>

实例3:创建电子邮件链接

<html><body><p>This is Email address<a href="mailto:someone@gmail.com?subject=Hello%20friend">Send Email</a></p><b>Note:</b>应该使用%20来替换单词之间的空格,这样浏览器就可以正确地显示文本了。</p></body></html>

实例4:创建电子邮件链接2

<html><body><p>This is another mailto link:<a href="mailto:someone@gmail.com?cc=someone@microsoft.com&bcc=andsomeone@163.com&subject=Summer%20Party&body=You%20are%20invited%20to%20a%20big%summer%20party!">Send Email</a></p><p><b>Note:</b>应该使用%20...</p></body></html>

<b>定义粗体字</b>

原创粉丝点击