Html link new tab
To open a link in a new tab in HTML, you can use the target
attribute and set its value to _blank
. Here is an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new tab</a>
This will open the link in a new tab when the user clicks on it.
You can also use the rel
attribute to specify that the link should be opened in a new tab. For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" rel="noopener noreferrer" target="_blank">Open in new tab</a>
The rel
attribute is optional, but it's a good practice to include it to prevent the new tab from being able to access the parent page's cookies and other sensitive information.
Note that the target
attribute can also be set to other values, such as _self
(which opens the link in the same tab), _parent
(which opens the link in the parent frame), or _top
(which opens the link in the full body of the window). However, _blank
is the most commonly used value for opening a link in a new tab.