Lecture

a Tag target Attribute

The target attribute of the <a> tag is used to specify whether a link should be opened in a new window or the current window.

a Tag target Attribute
<a href="link address" target="_blank">Link Text</a>
  • _blank: target="_blank" specifies that the link should be opened in a new window or tab. When clicked, the link address loads in a new window or tab. This allows the user to open the link independently of the current webpage, maintaining the original page in the browser.

  • _self: target="_self" specifies that the link should be opened in the current window. This means the link will load in the current webpage, replacing its content with the link's page. It indicates that after clicking the link, the current page is substituted with the new page.


The following HTML code creates a link labeled "Go to Google" and specifies that it should open in a new window.

Open Link in New Window
<a href="https://www.google.com" target="_blank">Go to Google</a>

If you add the above code to a webpage, a link saying "Go to Google" will be displayed. Clicking this link will open the Google website in a new window.

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help