如何在 HTML 中创建指向另一个文档的超链接?
使用 <a> 标签创建超链接。HTML <a> 标签用于创建超链接,可以链接到另一个文档,也可以链接到当前文档中的某个位置。
以下是属性:
| 属性 | 值 | 描述 |
|---|---|---|
| Charset | character_encoding | 定义链接文档的字符编码。 |
| Cords | 如果 shape = "rect",则 coords = "left, top, right, bottom" | 指定适合 shape 属性的坐标,以定义图像地图中图像的区域。 |
| download | filename | |
| Href | URL | 指定页面 URL 或链接指向的锚点的名称。 |
| Hreflang | language_code | 目标 URL 的语言代码。 |
| media | media_query | 它指定链接文档针对哪种媒体进行了优化。 |
| Name | section name | 标记页面中链接跳转到的区域。 |
| Rel | alternate 指定 stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | 描述当前文档和目标 URI 之间的关系。 |
| Rev | alternate 指定 stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | 指定目标 URL 与当前文档之间的关系。 |
| Shape | rect rectangle circ circle poly polygon | 在何处打开目标 URL。 _blank - 目标 URL 将在新窗口中打开。 _self - 目标 URL 将在点击它的同一框架中打开。 _parent - 目标 URL 将在父框架集中打开。 _top - 目标 URL 将在窗口的整个主体中打开。 |
| type | mime_type | 指定目标 URL 的 MIME(多用途互联网邮件扩展)类型。 |
示例
您可以尝试运行以下代码以创建链接:
<!DOCTYPE html> <html> <head> <title>HTML a Tag</title> </head> <body> <p>This is a link to <a href = "https://qries.com">Qries.com</a></p> </body> </html>
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP