Html target 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 target
attribute with other values, such as:
_self
: Opens the link in the same tab (default behavior)_parent
: Opens the link in the parent frame (if the page is framed)_top
: Opens the link in the full body of the window (if the page is framed)_blank
: Opens the link in a new tab or window
For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_self">Open in same tab</a>
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_parent">Open in parent frame</a>
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_top">Open in full window</a>
Note that the target
attribute only works for links that are not already in a frame. If you want to open a link in a new tab from within a frame, you will need to use JavaScript to achieve this.