Computerhelp4all logo Articles AboutTopicsQuizzesComputer Questions & AnswersComputer Terms & DefinitionsActivitiesContact

What Is The HTML <a> Target Attribute?

What Is The HTML a Target Attribute

Date First Published: 19th December 2022

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 6/10

Learn more about what the HTML <a> target attribute is in this article.

The HTML <a> target attribute is used to specify where to open the linked page. If no target is specified, the link will open in the same frame. This attribute can contain five possible values, which are listed below.

Value Description
_blank Opens the link in a new tab.
_self Opens the link in the same frame (default)
_parent Opens the link in the parent frame (deprecated in HTML5)
_top Opens the link in the top-most frame (deprecated in HTML5)
framename Opens the link in the named frame (deprecated in HTML5)

Even though there are five possible values, the only relevant one is _blank. The other values were used to specify frames (the ability to place one document inside another), which were deprecated in HTML5. Frames were deprecated in HTML5 because they create usability and accessibility issues, such as difficulty printing and bookmarking pages, and difficulty for screen readers and other assistive technologies to understand them. The ability to create frames still exists, but they are now considered obsolete by the W3C.

Example Of The HTML <a> Target Attribute

<a href="https://example.com" target="_blank">Example Hyperlink</a>

The link can be clicked on below. It will open in a new tab.

Example Hyperlink

With the _blank value, links will open in a separate tab, allowing a user to click on it without leaving the age they are visiting. This can help keep visitors on a site for longer and it is recommended to add this attribute when adding external links to a website.

Some people believe that users do not prefer to open links in a new tab as they think that they are similar to popup ads that unexpectedly open in a new tab. However, most users prefer to open links in a new tab because it allows them to read pages later without being taken off the page they are currently browsing.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.








>