How to open a link in a new tab using HTML?

Published January 4, 2021

To open a link in a new tab you can use the target attribute on an anchor tag and set its value to __blank.

For example, consider an anchor tag like this,

<a href="https://google.com">Google</a>

Currently, if you click on this anchor tag it will open on the same page itself, which is the normal behavior of an anchor tag.

Now let's add the target="__blank" attribute to this anchor tag so that it will open the link in a new tab when the user clicks on it.

<a href="https://google.com" target="__blank">Google</a>

That's it 🌟.

See this example live in JSBin.

Feel free to share if you found this useful 😃.


Share on: Facebook Twitter