Html make links open in new tab

To make a link open in a new tab in HTML, you can add the target attribute to the a tag and set its value to _blank. Here's an example:

<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Link to example.com</a>

This will open the link in a new tab or window when clicked.

You can also use the rel attribute to specify that the link should be opened in a new tab. The rel attribute is used to specify the relationship between the current document and the linked document. In this case, you can set the value to noopener to prevent the linked page from accessing the current page's context:

<a rel="nofollow" target="_blank" href="https://www.example.com" rel="noopener noreferrer" target="_blank">Link to example.com</a>

Note that the noopener value is recommended to prevent potential security issues.

You can also use JavaScript to achieve this, by using the window.open() method:

<a rel="nofollow" target="_blank" href="https://www.example.com" onclick="window.open(this.href, '_blank'); return false;">Link to example.com</a>

This will open the link in a new tab when clicked, and prevent the default link behavior from occurring.