click and open in new tab html code example

Example 1: a tag open in new tabn

<a target="_blank" href="https://example.com">Link text</a>

Example 2: a tag open in new tab

<a href="#" target="_blank" rel="noopener noreferrer">Link</a>

Example 3: make page open in new tab html

<p>Check out <a href="https://www.freecodecamp.org/" target="_blank" rel="noopener noreferrer">freeCodeCamp</a>.</p>

Example 4: open new tab when clicking link html

<!-- add target="_blank" to open new tab when link is clicked [in HTML]-->
<a href="YourLink" target="_blank">YourText</a>