Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

target

`target` chooses where a link opens; `rel` describes the relation to the linked page.

Syntax

<a href="url" target="_blank" rel="noopener">…</a>

Parameters

ParameterTypeDescription
target_self | _blank | frame nameWhere to open the link: the same tab, a new one or a frame.
relnoopener | nofollow | noreferrer | …The relation between the current page and the linked one.

Examples

A new tab and a link that passes no ranking to search engines:

<p><a href="https://example.com" target="_blank" rel="noopener">Open in a new tab</a></p>
<p><a href="https://example.com" rel="nofollow">A sponsored link</a></p>

Notes

Without noopener the opened page can control the tab that opened it; modern browsers add it for _blank automatically, but writing it explicitly is a good habit. Do not open every link in a new tab: let users decide where to open links.

See also

  • <a> — A link to another page, a file or a place on the page.
  • href — The address an `<a>` link leads to or a `<link>` points at.
  • <form> — A form: collects data from its fields and sends it to the server.

Related recipes

In the tutorial

  • Links — The a tag and the href attribute, absolute and relative addresses, jumps within a page, a new tab, email and phone links.

Thanks for reading!

Donate to the site — we work hard for you.