Techstacker
Light ModeDark ModeReset dark mode. Falls back to OS dark mode setting.

Pages

No results for 'undefined'

Blog Posts

No results for 'undefined'
Powered by Algolia

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

Oct 11, 20191 min readHTMLViews:

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">Go to Techstacker.com</a>

As simple as that, happy linking!