How to Open a Link (ahref) in a New Browser Tab With HTML

To open a link (a href) in a new browser window you need to add one more attribute to your HTML anchor element (<a>) namely, the target attribute.

Just like the href attribute needs a link path value (the URL), the target attribute needs a specific value to trigger the browser to open a new tab when you click on the link. This value is called _blank.

Here's a link that goes to the techstacker front page via a new tab:

Go to Techstacker.com

HTML code for the example:

<a href="https://techstacker.com" target="_blank" rel="noopener">Go to Techstacker.com</a>

As simple as that, happy linking!


Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊

Kofi

Share & Discuss on