如何在 HTML 中创建超链接以链接到其他文档?
htmlweb developmentfront end technology更新于 2025/8/15 0:44:17
使用 <a> 标签创建超链接。HTML <a> 标签用于创建指向其他文档或当前文档中某个位置的超链接。
以下是 − 的属性
| 属性 | 值 | 描述 |
|---|---|---|
| Charset | character_encoding | 定义链接文档的字符编码。 |
| Cords | if shape = "rect" then coords = "left, top, right, bottom" | 指定适合形状属性的坐标来定义图像地图的图像区域。 |
| download | filename | |
| Href | URL | 指定页面的 URL 或链接指向的锚点的名称。 |
| Hreflang | language_code | 目标网址的语言代码。 |
| media | media_query | 它指定了链接文档针对哪种媒体进行了优化 |
| Name | section name | 标记链接跳转到的页面区域。 |
| Rel | alternate designates stylesheet start next prev contents index glossary copyright chapter section subsection appendix help bookmark | 描述当前文档与目标 URI 之间的关系 |
| Rev | alternate designates 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>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

