Links

HTML links are created using the <a> (anchor) tag. Users can click a link to jump to another page, section, or resource.

Syntax

<a href="URL">Link Text</a>

Example

Output :

The 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.

Syntax

<a href="URL" target="value">Link Text</a>

Available target Values

Value 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.

Examples

1. Open in Same Tab (default)

<a href="page.html" target="_self">Open in Same Tab</a>

2. Open in New Tab

<a href="https://example.com" target="_blank">Open in New Tab</a>

3. Open in Parent Frame

<a href="parent.html" target="_parent">Open in Parent Frame</a>

4. Open in Full Body (Top Frame)

<a href="main.html" target="_top">Open in Full Window</a>

Example target="_blank"

Output :

URLs vs. Relative URLs

Output :

Use an Image as a Link

Output :

Email Address

Output :

Button as a Link

Output :

Link Titles

Output :