Content · Web Development · HTML

HTML target Attribute: Same Tab and New Tab

Target controls where a link opens. By default, an ordinary link usually navigates in the current tab; target="_blank" requests a new browsing context.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Target controls where a link opens. By default, an ordinary link usually navigates in the current tab; target="_blank" requests a new browsing context. The important question is always where the link leads and whether the person reading the page can predict it.

What You Need to Know


Only open a new tab when it helps the visitor, and let the link text announce the behavior when it may surprise them.

Links are the pathways through a website. The words on a link should help someone choose where to go before clicking it.

Example: See It in Action


This example keeps the idea small. Copy it carefully, then follow the explanation instead of guessing what the browser will do.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<a href="about.html">Open in this tab</a>
<a href="projects.html" target="_blank" rel="noopener">
    Open projects in a new tab (opens in a new tab)
</a>

Let’s Understand the Example


  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • Target chooses the browsing context where a link opens. Blank usually opens a new tab.
  • Href contains the destination of a link. A value starting with # points to an id on the same page.
  • Rel describes a relationship to the linked page or resource, including security and search hints.

The first example link points to about.html. Check whether that destination exists relative to the document. A link changes where readers go; it does not perform an action such as saving a form.

What Should You See?


You should see a link named “Open in this tab”. Selecting it leads to about.html when that destination exists. Try it with the mouse and the keyboard.

Imagine this link is read out of context. Would its text still explain the destination? Rename unclear links before trying to make them look nicer with CSS.

Try It Yourself


  1. Change one link to open in the same tab and compare the navigation experience.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Opening every internal page in a new tab without a good reason.
  • Avoid dead links, empty href values and clickable-looking text without a real destination.

Key Takeaways


  • Target controls where a link opens.
  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • Only open a new tab when it helps the visitor, and let the link text announce the behavior when it may surprise them.
Share this resourceSend this page to someone who may find it useful.