如何在 HTML 中指定打开链接文档的目标位置?
htmlweb developmentfront end technology更新于 2026/1/17 16:12:17
使用 target 属性指定在 HTML 中打开链接文档的目标位置。以下是 target 属性 −
的值| 属性 | 描述 |
|---|---|
| _blank | 在新标签页中打开链接页面。 |
| self | 在当前标签页中打开链接页面选项卡。 |
| parent | 在父框架中打开链接页面。 |
| top | 在最顶部框架中打开链接页面。 |
示例
您可以尝试运行以下代码来实现target属性 −
<!DOCTYPE html> <html> <head> <title>HTML target attribute</title> </head> <body> <h2>References</h2> <p>Refer the following <a href = "https://www.qries.com/questions.php" target = "_blank">website</a>.<br> The above link will open in a new tab.</p> </body> </html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

