如何在html上的新标签中打开链接? [英] How to open link in new tab on html?
问题描述
我正在研究一个HTML项目,我无法找到如何在没有javascript的新选项卡中打开链接。
I'm working on an HTML project, and I can't find out how to open a link in a new tab without javascript.
我已经知道< a href =http://www.WEBSITE_NAME.com>< / a>
会打开相同标签中的链接。任何想法如何使它打开一个新的?
I already know that <a href="http://www.WEBSITE_NAME.com"></a>
opens the link in same tab. Any ideas how to make it open in a new one?
推荐答案
设置链接的'target'属性为<$ c
$ b
Set the 'target' attribute of the link to _blank
:
<a href="#" target="_blank">Link</a>
编辑:对于其他示例,请参阅此处: http://www.w3schools.com/tags/att_a_target.asp
for other examples, see here: http://www.w3schools.com/tags/att_a_target.asp
(注意:我之前建议空白
而不是 _blank
,因为如果使用它,它会打开一个新选项卡,然后使用如果链接被再次点击,则是同一个标签,但是,这只是因为,正如GolezTrol指出的那样,它指的是框架/窗口的名称a,当再次按下链接以打开它时,它将被设置和使用相同的标签)。
(Note: I previously suggested blank
instead of _blank
because, if used, it'll open a new tab and then use the same tab if the link is clicked again. However, this is only because, as GolezTrol pointed out, it refers to the name a of a frame/window, which would be set and used when the link is pressed again to open it in the same tab).
这篇关于如何在html上的新标签中打开链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!