New tab html
To open a new tab in HTML, you can use the target
attribute in the a
tag. The target
attribute specifies where the linked document should be opened.
Here is an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new tab</a>
The _blank
value tells the browser to open the linked document in a new tab.
You can also use the target
attribute with other values, such as:
_self
: Open the linked document in the same tab (default behavior)_parent
: Open the linked document in the parent frame (if the page is framed)_top
: Open the linked document in the full body of the window (if the page is framed)_blank
: Open the linked document 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 point to external resources (e.g. web pages, images, etc.). If you try to use it with a link that points to an internal resource (e.g. a section of the same page), it will not work as expected.