Sometimes, we want to open a link in a new tab in HTML.
In this article, we’ll look at how to open a link in a new tab in HTML.
How to open a link in a new tab in HTML?
To open a link in a new tab in HTML, we can set the target
attribute to _blank
.
For instance, we write
<a href="#" target="_blank" rel="noopener noreferrer">Link</a>
to set the a
element’s target
attribute to _blank
to open the href
URL in a new tab.
Conclusion
To open a link in a new tab in HTML, we can set the target
attribute to _blank
.