HTML links are created using the <a>
(anchor) tag. Users can click a link to jump to another page, section, or resource.
<a href="URL">Link Text</a>
target
Attribute
By default, when a user clicks an HTML link, the browser loads the linked page in the same window or tab.
The target
attribute allows you to control where the linked document opens.
<a href="URL" target="value">Link Text</a>
target
ValuesValue | Description |
---|---|
_self |
Default. Opens in the same tab or window. |
_blank |
Opens in a new tab or window. |
_parent |
Opens in the parent frame. |
_top |
Opens in the full window, removing any frames. |
<a href="page.html" target="_self">Open in Same Tab</a>
<a href="https://example.com" target="_blank">Open in New Tab</a>
<a href="parent.html" target="_parent">Open in Parent Frame</a>
<a href="main.html" target="_top">Open in Full Window</a>